calcite-design-system icon indicating copy to clipboard operation
calcite-design-system copied to clipboard

feat(dialog, modal, popover, input-date-picker, input-time-picker, sheet): support stacked component sequential closing with escape

Open Elijbet opened this issue 9 months ago • 5 comments

Related Issue: #6456

Summary

Support component sequential closing with escape by having focus-trap handle the stacking order.

Elijbet avatar Apr 30 '24 23:04 Elijbet

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

github-actions[bot] avatar May 16 '24 01:05 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

github-actions[bot] avatar May 24 '24 01:05 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

github-actions[bot] avatar Jun 19 '24 01:06 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

github-actions[bot] avatar Jun 29 '24 01:06 github-actions[bot]

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

github-actions[bot] avatar Aug 17 '24 01:08 github-actions[bot]

To recap, this is where we are:

  • Cleanup modal and dialog by double checking for a single way to close both focus-trap enabled and disabled cases. That is, scrim has a click handler that does the closing, we want to make sure we don’t handle closing also with focus trap. If scim is meant to close everything maybe we also use it to close the focus trap. If not, lets keep it as is.

  • We confirmed that input-date-picker still closes on outside click, so comment regarding that is no longer relevant.

  • There is an outstanding focus-trap PR to enhance so it will allow child elements to handle Escape key presses without causing the trap to close. We might have to wait for this to land to pick up the remaining comments.

Elijbet avatar Sep 06 '24 02:09 Elijbet

This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions.

github-actions[bot] avatar Sep 19 '24 01:09 github-actions[bot]

There is an https://github.com/focus-trap/focus-trap/pull/1253 to enhance so it will allow child elements to handle Escape key presses without causing the trap to close. We might have to wait for this to land to pick up the remaining comments.

We recently updated focus-trap, which now allows child elements to handle Escape key presses without closing the trap, but I noticed that dialog doesn't have logic to ignore canceled Escape key presses within focus-trap. Can you check that this is handled? Any code handling Escape like this should be changed to go through focus-trap, similar to this example.

jcfranco avatar Sep 25 '24 23:09 jcfranco

Could you also coordinate input-date-picker changes w/ @anveshmekala? Additional coverage was added all date-picker-related test suites (see https://github.com/Esri/calcite-design-system/pull/8402/files).

jcfranco avatar Sep 25 '24 23:09 jcfranco

Could you also coordinate input-date-picker changes w/ @anveshmekala? Additional coverage was added all date-picker-related test suites (see #8402 (files)).

Checked with him and there are no conflicts so far.

Elijbet avatar Sep 26 '24 16:09 Elijbet

This is the gist of the test @DitwanP, @geospatialem.

Whenever a focus-trapping component opens, it traps focus and gets added to the stack. Pressing escape should deactivate each returning focus to the next component in the stack.

I recommend setting up a stack of all focus-trap components as open, mimicking the setup in the e2e, but have 2 separate stacks with popover containing either input-time-picker or input-date-picker, as you can't have both open at the same time.

Click outside also needs to be tested. It's usually set to false. For input-date-picker and input-time-picker closing with click outside is delegated to popover: https://github.com/Esri/calcite-design-system/pull/9231/files#diff-42c23e5a429472ae2ecb636c2ba383162681d40c5ff70c3f89be55d376052e32R1002 So whatever the expected behavior for popover is in this case.

Elijbet avatar Oct 07 '24 20:10 Elijbet