Skip to content

Conversation

@jperals
Copy link
Member

@jperals jperals commented Dec 2, 2024

Description

Issue: AWSUI-60031

Now the split panel in the new toolbar layout behaves the same as in the old layout when it is displayed at the bottom:

  • When collapsed:
    • it does not completely disappear but instead the header and the open button keep being visible overlaying the bottom part of the content
    • the focus moves to the split panel's own open button instead of the toolbar's split panel trigger
  • The findSplitPanelOpenButton test util will return the open button in the split panel and not the toolbar split panel trigger

How has this been tested?

  • Manually on dev pages
  • Adapted existing tests
  • Ran through my pipeline, got an expected diff
  • Dry run (7138307483)
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.34%. Comparing base (c04ca9c) to head (9e83dd3).
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3086   +/-   ##
=======================================
  Coverage   96.34%   96.34%           
=======================================
  Files         779      778    -1     
  Lines       21913    21910    -3     
  Branches     7443     7453   +10     
=======================================
- Hits        21112    21110    -2     
+ Misses        749      748    -1     
  Partials       52       52           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

test(
'Shows tooltip correctly for split panel trigger for keyboard (tab) interactions',
setupTest({ theme, size, splitPanelPosition }, async (page: AppLayoutDrawersPage) => {
await expect(page.isExisting(tooltipSelector)).resolves.toBe(false);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path taken by these tests to focus the split panel trigger in the toolbar was not working anymore because it was assuming that the focus stays on the trigger after clicking it, but now it moves to the split panel.

@jperals jperals marked this pull request as ready for review December 3, 2024 09:53
@jperals jperals requested a review from a team as a code owner December 3, 2024 09:53
@jperals jperals requested review from Al-Dani and removed request for a team December 3, 2024 09:53
@just-boris
Copy link
Member

This change broke split panel slide in animation.

It works fine in the mainline and does not on your PR preview build: https://d21d5uik3ws71m.cloudfront.net/components/783ac3514ee5eb19adb067e5c023a114f456691e/dev-pages/index.html#/light/app-layout/with-split-panel?appLayoutToolbar=true

@jperals
Copy link
Member Author

jperals commented Dec 5, 2024

This change broke split panel slide in animation.

Thanks for noticing! This was addressed in the latest commit (c074481).

Comment on lines 25 to 26
await page.keys(['Tab', 'Tab']); // Focus the first drawer trigger past the split panel trigger
await page.keys(['Shift', 'Tab']); // Tab back to the split panel trigger
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do this back-and-forward focus in every test? Is it really worth reusing this code? For example, you could only reuse the assertion part.

testutilStyles['drawers-trigger'],
splitPanelTestUtilStyles['open-button']
testutilStyles['split-panel-trigger'],
splitPanelResolvedPosition === 'side' && splitPanelTestUtilStyles['open-button']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep this test util class assigned in both cases.

The collapsed split panel will not use this class. All customers' tests will open split panel using this button in every position


useResizeObserver(headerRef, entry => {
const { borderBoxHeight } = entry;
closedPanelBlockSize.current = `calc(${borderBoxHeight}px + ${tokens.borderPanelTopWidth})`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line does not look like idiomatic React code. What is happening here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using closedPanelBlockSize.current as blockSize in line 86 in order to keep the animated transition. This gives the element the same height that it would already have without applying any value, but a value needs to be explicitly set because you cannot transition from or to undefined; a value has to be defined for the transitioned property in both states.

What do you find most non-idiomatic here? Do you have any suggestion? Or does it look better knowing this information?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For idiomatic code, it should be a state, not ref. Also, can we reuse reportHeaderHeight somehow which already sets the state?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can pass down reportHeaderHeight from the app layout, although it is only needed for the toolbar layout, so either we have to make it optional in the split panel context, or we pass it anyway in the three app layouts, whether it is actually used in the split panel or not.

Copy link
Member

@just-boris just-boris Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's introduce our own local state then.

Also see cloudscape-design/component-toolkit#107, I added optimization for multiple state changes in this case

@jperals jperals force-pushed the feat/split-panel-visibility branch from c074481 to bb22459 Compare December 5, 2024 12:59
@jperals jperals changed the title feat: Make split panel visible when collapsed at the bottom also in new toolbar layout feat: Make split panel visible when collapsed at the bottom in new toolbar layout Dec 5, 2024
@jperals jperals added this pull request to the merge queue Dec 6, 2024
Merged via the queue into main with commit 6006683 Dec 6, 2024
38 checks passed
@jperals jperals deleted the feat/split-panel-visibility branch December 6, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants