SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1.01k forks source link

Can't focus on normally focusable elements when pressing the tab key on the keyboard #9005

Open tdwhite0 opened 1 year ago

tdwhite0 commented 1 year ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

πŸ’₯ SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

Additional environment details

latest Chrome and Edge

Describe the bug / error

Elements added to a SharePoint page that are inside Shadow Roots are unable to be focused on with the tab key. Tabbing through the page will completely skip over these elements. I have created a simple reproduction showing the most simple case. Our real world usage is using Stencil Web Components, which all have this issue when using Shadow DOM.

Steps to reproduce

  1. Create a basic WebPart and use Shadow Root to add normally focusable inputs and buttons like in this reproduction I have made here: https://github.com/tdwhite0/sp-shadowdomissue-repro
  2. Observe that the tab key skips over them when going through the page.
image

Expected behavior

Elements should be focusable with the tab key.

From digging through what SharePoint is doing, I can see that there is an Accessibility manager component that tries to determine the next focusable element. This code does not take into account elements that are in Shadow Roots.

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

marnocha commented 1 year ago

Any updates on this issue? I have a couple customers that this is impacting and accessibility should be a priority from an issue standpoint.

gavinbarron commented 1 year ago

This is also impacting customers using Microsoft Graph Toolkit. We have a report from a customer on our repo that we have verified and tested as only being an issue when used in the context of webparts in a SharePoint page https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/1909

tdwhite0 commented 1 year ago

For more information, if you search the SharePoint OOB javascript for "_queryFocusableSelector" you can find the method that searches the DOM for focusable elements.

image

This querySelector does not return elements in Shadow DOM so therefore elements inside will never be returned.

marnocha commented 11 months ago

@AJIXuMuK - Any updates on this issue?

USCloud-EricWilborn commented 11 months ago

@VesaJuvonen @AJIXuMuK - What is the progress of this issue being addressed? Any status updates at all would be appreciated.

AJIXuMuK commented 11 months ago

@USCloud-EricWilborn - we have this issue in the internal backlog of the responsible team. Unfortunately, there is no ETA.

marnocha commented 10 months ago

@VesaJuvonen @AJIXuMuK any further updates on this?

marnocha commented 8 months ago

@VesaJuvonen @AJIXuMuK any further updates on this?

tumbleweed05 commented 7 months ago

Maybe Q2 2024, perhaps later for a fix.

marnocha commented 4 months ago

Hi @tumbleweed05 - as we are in Q2 2024, any updates on timing for a fix or solution? Appreciate any updates you can provide.