Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: calcite-popover - trap focus inside #2133

Closed
2 tasks
AdelheidF opened this issue May 13, 2021 · 13 comments
Closed
2 tasks

Bug: calcite-popover - trap focus inside #2133

AdelheidF opened this issue May 13, 2021 · 13 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. design Issues that need design consultation prior to development.

Comments

@AdelheidF
Copy link

AdelheidF commented May 13, 2021

All 3 sub-issues here a related, so I added them into the same issue.

(1) (fixed with the use of `calcite-list`)
Add an option to value list to not allow selection of the text, only `action-end`.

image

This is a lists of values in the filter component, clicking on a value name does not call an action. Only action-end matters here.
image

This is a list of detailed information inside a popover. Nothing should happen when you click on the text, only action-end matters here as well.
image

(2) (fixed with the use of `calcite-list`)
Navigating in this value list is a bit weird. Initially only the first row, first text then action-end, can be selected. If you then tab again it leaves the list. You need to use the down arrow to navigate inside the list, but the down arrow only works on the text, not on action-end. Same with `calcite-pick-list`.

(3)
Focus gets lost if there if no other focusable item after the value-list when using tab key after action-end is selected. This is a problem for keyboard only users in the popover case above. How can I catch the focus (or know when the focus leaves value-list) and redirect it back to the close icon of the popover? I tried onBlur but that didn't work.
Scenario:
popover opens with close button on focus. Then I tab my way through the list. After the last focusable item in the list is active and I hit tab the focus gets lost.


New list component #2117

Actual Behavior

Expected Behavior

Reproduction Steps or Sample

Relevant Info

Version: @esri/calcite-components@<version>

  • CDN
  • NPM package
@AdelheidF AdelheidF added bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 0 - new New issues that need assignment. labels May 13, 2021
@TheBlueDog
Copy link

Follow

@AdelheidF AdelheidF changed the title Bug: calcite-value-list selection issues Bug: calcite-list focus gets lost when used inside popover Aug 5, 2021
@AdelheidF
Copy link
Author

(1) and (2) are fixed with the use of the new calcite-list. (3) is still valid. Changed the title.

@benelan benelan added the needs triage Planning workflow - pending design/dev review. label Sep 27, 2021
@jcfranco jcfranco added the design Issues that need design consultation prior to development. label Oct 8, 2021
@jcfranco jcfranco assigned jcfranco and macandcheese and unassigned jcfranco Oct 8, 2021
@macandcheese
Copy link
Contributor

@AdelheidF can you put together a codepen that illustrates this bug? Thanks!

@AdelheidF
Copy link
Author

https://codepen.io/afreitag/pen/LYjmaWv?editors=1000

Click on the button to open the popover. Wait until focus sits on close button, now tab 4 times, all good. Now tab one more time, the focus should go back to the close button. How can I know that the focus left the list to set it back to the close button? A keyboard-only user would be lost now.

@benelan benelan added this to the Sprint 11/22 - 12/3 milestone Nov 16, 2021
@benelan benelan removed the needs triage Planning workflow - pending design/dev review. label Nov 16, 2021
@macandcheese
Copy link
Contributor

Is this specific to list? Looking at it now it just seems like we don't trap focus inside a popover. That seems like a reasonable thing to have support though.

@AdelheidF
Copy link
Author

AdelheidF commented Jan 5, 2022

Is this specific to list?

not really, trap focus inside a popover when only using tab key is the better description for what I need probably.

@AdelheidF AdelheidF changed the title Bug: calcite-list focus gets lost when used inside popover Bug: calcite-popover - trap focus inside Jan 12, 2022
@driskull
Copy link
Member

driskull commented Nov 1, 2022

@jcfranco should we use this npm package for this? https://www.npmjs.com/package/focus-trap

We could update the modal to use this package too.

@driskull driskull self-assigned this Nov 16, 2022
@driskull driskull added 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. labels Nov 16, 2022
driskull added a commit that referenced this issue Nov 18, 2022
…y. (#5725)

* refactor(modal): Update modal to use focus-trap module.

* cleanup

* cleanup

* fix test

* cleanup

* cleanup

* remove `previousActiveElement` internal prop. focus utility handles this already.

* set fallbackFocus element.

* feat(popover): Add focus-trap to popover. #2133

* cleanup

* cleanup

* cleanup

* add disableFocusTrap prop to popover

* review feedback

* add spec test

* revert changes

* add popover tests for setFocus
@driskull driskull added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Nov 18, 2022
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Nov 23, 2022
@geospatialem
Copy link
Member

Verified on next.639

verify-popover-trap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. design Issues that need design consultation prior to development.
Projects
None yet
Development

No branches or pull requests

7 participants