Skip to content

[EuiDataGrid][a11y] When cell popover contains interactive children, opening and closing the cell popover strands focus  #5646

Closed

Description

@cee-chen

Screencap of issue

screencap

Repro steps

  1. Open Safari
  2. Go to https://elastic.github.io/eui/#/tabular-content/data-grid
  3. Click any Date or Amount cell (any cell that does not have cell actions or interactive popover children)
  4. Press the Enter key to open the popover
  5. Press the Escape key to close the popover
  6. Notice that focus is correctly restored back to the cell that opened the popover
  7. Click any Account or Name cell (any cell that has cell actions or interactive popover children)
  8. Press the Enter key to open the popover
  9. Press the Escape key to close the popover
  10. Notice that focus is not restored back to the cell that opened the popover but instead was returned to the entire document body

Browser info

I was testing in Safari+VO, but this happens in Safari without VO on (EDIT: or does it?? it appears not??). On Firefox I've experienced this intermittently and can't seem to isolate why, sometimes cell popover refocus works perfectly and other times it doesn't. It doesn't appear to happen for me on Chrome.

Thoughts/approach

I suspect FocusTrap is the underlying issue for this, but it looks like there's no difference in testing between 47.0.0 (the react and focus-trap upgrade) and 42.0.0 (a random old datagrid release) so it's unlikely that it's a recent issue. I'll probably work to address this at the data grid level rather than the focus trap level.

Activity

  1. cee-chen commented on Feb 17, 2022

    @cee-chen
    ContributorAuthor

    @1Copenut if you have a quick second, I'd love it if you could confirm that you can repro the above issue! I'm getting some inconsistent results and I'm not sure if I'm hallucinating or not.

  2. 1Copenut commented on Feb 22, 2022

    @1Copenut
    Contributor

    @constancecchen I'm able to recreate the issue you described, with some interesting caveats:

    1. Safari sets and returns focus correctly on Date and Account cells when VoiceOver is not running
    2. Safari sets and returns focus correctly on Date cells when VoiceOver is running
    3. Safari fails to return focus correctly on Account cells when VoiceOver is running

    It's this third item that has my curiosity piqued. Focus is set on the <body> tag best I can gather when I press ESC on an account cell. I can't say if it's a timing issue, or VoiceOver interrupting an event handler, or something else.

  3. cee-chen commented on Feb 22, 2022

    @cee-chen
    ContributorAuthor

    I can repro those behaviors/conditions exactly. Thanks a million Trevor! Super bizarre that VO would affect the focus behavior - I wonder if we need to do more QA testing with VO + EuiPopover across the board 😬 (hopefully not!)

  4. cee-chen commented on Feb 23, 2022

    @cee-chen
    ContributorAuthor

    @1Copenut So unfortunately I can reproduce this on almost all buttons on https://elastic.github.io/eui/#/layout/popover, even ones without interactive children for some reason.

    • When VO is open, it takes hitting the escape key twice rapidly to close the popover (not sure why)
    • Even without any interactive children closing the popover strands focus back onto the top of the document and not to the triggering element

    I'm not sure when this started happening, but I think unfortunately we have to solve this at the popover level, as this affects multiple datagrid popovers (e.g. toolbars, not just cells).

  5. 1Copenut commented on Feb 24, 2022

    @1Copenut
    Contributor

    We're widening the technology scope to see if this is a general bug or a browser specific one. Will check off browser + screen reader pairs as they're tested with a note if the Popover behavior linked in previous comment passes or fails.


    Testing Methodology

    1. Start screen reader of choice
    2. Open URL in browser
    3. Arrow or tab to buttons
    4. Press Enter or Ctrl + Opt + Space or tap to open a popover
    5. Press Esc to close the popover
    6. Assert focus is returned to the originating button
    7. Open the popover again, and navigate to text inside it
    8. Close the popover
    9. Assert focus is correct for a second time

    Test Group 1

    https://elastic.github.io/eui/#/layout/popover

    • Fail: MacOS + Safari + VoiceOver
    • Pass: MacOS + Chrome latest + VoiceOver
    • Fail: iOS + Safari + VoiceOver (user is trapped in dialog, must tap outside, focus on body)
    • Pass: Win10 + Edge + NVDA
    • Pass: Win10 + Edge + JAWS

    Test Group 2

    https://elastic.github.io/eui/#/layout/modal

    • Pass: MacOS + Safari + VoiceOver
    • Pass: MacOS + Chrome latest + VoiceOver
    • Pass: iOS + Safari + VoiceOver

    Test Group 3

    https://elastic.github.io/eui/#/layout/flyout

    • Mostly pass: MacOS + Safari + VoiceOver (Push flyouts do not keep focus on the button correctly)
    • Pass: MacOS + Chrome latest + VoiceOver
    • Fail: iOS + Safari + VoiceOver (Flyouts are not announced and focus is not set)
  6. cee-chen commented on Feb 24, 2022

    @cee-chen
    ContributorAuthor
  7. 1Copenut commented on Feb 24, 2022

    @1Copenut
    Contributor

    I'll add those as test groups after an early lunch break

  8. zuhairmahd commented on Feb 24, 2022

    @zuhairmahd

    The focus is being properly returned to the button with JAWS and NVDA. I am not sure this is something we need to worry about in VoiceOver due to the way Voiceover works. Voiceover treats a web page as a hierarchical structure. When you are in a table and are navigating its cells, and when you trigger a modal, VoiceOver does not always go back to the specific cell you were in but goes to the higher layer (the table itself). You could mitigate this behaviour in one of two ways: turn on Quick Navigation mode by pressing left and right arrows together and use the arrow keys to navigate and up and down arrow together to simulate the enter key, or enable keyboard navigation in the voiceover utility under the web navigation category (the latter is discouraged as you will see in the popup that shows up when you try to enable it). I'd be happy to demonstrate if needed.

  9. 1Copenut commented on Feb 24, 2022

    @1Copenut
    Contributor

    Interesting, thank you @zuhairmahd for testing and providing this explanation of how VO defines page structure.

    I'm not sure to call this a bug or just a quirk in how VoiceOver organizes things. The EuiPopover doesn't return focus when I use arrow keys to listen to the content inside the modal, but does handle focus correctly when the popover is inside a modal like our EuiFlyout component.

    At any rate, we have determined this is a Safari + VoiceOver specific item. I'd like to standardize behavior if we can, with understanding this might be a backlog or longer-tail item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions