FocusZone: Issue with role=presentation
Bug Report
- Browser and OS versions: Firefox
Priorities and help requested (not applicable if asking question):
Are you willing to submit a PR to fix? No
Requested priority: (Blocking, High, Normal, Low)
Products/sites affected: VSTS
Describe the issue:
I have a react component which includes some labels and input box. There are two modes: read and edit mode. With FF and NVDA, we are not able to enter any text in the input NVDA is going into Form Mode. But when I tried changing the role=toolbar in the browser DOM, I was able to type in the input box without changing the mode in NVDA.
What's underlying idea behind using role=Presentation in FocusZone? Can we also get some recommendations here about what should be done here?
Actual behavior:
With FF and NVDA, Not able to input text in input box inside FocusZone but it works when changes to role=toolbar in DOM.
Expected behavior:
Typing text should work for input box inside focuszone with FF and NVDA.
If applicable, please provide a codepen repro:
@twarzo - curious, how are you using the FocusZone? Are you passing in something for the elementType prop? role=presentation should be harmless when used on div, which is the default for this prop. (But I'm then wondering why it's even there in the first place.)
@ThomasMichon - any idea why it was added here? It looks like this was added back in #90ef0576 - but back then, the element type was always a div, so role=presentation should have been unnecessary/redundant.
@BrendanMcK I'm not using elementType prop.
@dzearing @jspurlin can this be an issue with the screenreader? And if so, do we keep this issue open?
@twarzo what version of Firefox are you using? Starting in version 57 (which was released 11/14/2017) Firefox switched to a new browsing engine that had a large negative impact on accessibility... I wonder if this could be a side effect of that. (@Vitalius1 as an fyi)
+1 for @BrendanMcK 's comment, the div doesn't need role presentation, it's redundant for div elements.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 5 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fabric React!
@jspurlin It's happening in latest chrome as well. I am using Firefox 62.0.3.
@ThomasMichon Could we remove this role=presentation for the FocusZone div? There seems to be little reason why we have this on there.
@jdhuntington Just adding you here to help make sure we don't lose track of this. Either we remove role=presentation, or have good reasoning for why it's there. I've pinged @ThomasMichon in chat.
Keep in mind that the default 'role' for a div element is 'group'. Narrator and JAWS will both diligently read 'group' after reading the content of a div. Since FocusZone is normally a utility component with no intended semantic impact, it should not announce itself by having a role. If people overload a FocusZone with intent to actually use it (and the new focus-park behavior does this), then for those cases role should be something else, obviously.
In office-ui-fabric-react, <FocusZone> is frequently intertwined with other semantically-meaningful structures. Letting it have a default role would harm the accessibility of those structures. We'd have to modify all the usages in office-ui-fabric-react to set role='presentation' if we changed this.
An idea might be to set role='presention' only if Tag is div or span. That would ensure the semantic meaning of the override element is not erased.
I think it's really up to the use case to pick the right role.
If you provide your own role on FocusZone, it will replace the default. The component does not prohibit you to use a more appropriate role for the scenario, and the FocusZone itself is really unaware of the use case.
@twarzo Is this behavior different on Narrator or Jaws or VoiceOver or ChromeVox? It would help to have a codepen of your scenario here.
a div or span should not have role="presentation", that doesn't remove the node from the tree, it'll just make it role="group" (which it already is by default).
In fact, putting role="presentation" make this issue worse, modern browsers/ATs are smart enough to not make every div/span a node in the tree, unless it is "interesting" from an accessibility standpoint. One of the things that makes an element interesting includes adding an accessible name or explicitly setting a role. That means in this case that the fact that role="presentation" is being adding is making the div show up in the tree.
Here's a very simple jsfiddle that demonstrates this, and here's the resulting nodes in the UIA tree:

Notice how the first div does not show up as a node in the tree but the second div does (since it explicitly has a role set on it)
Is the recommendation then to remove role=presentation and leave it up to the scenario? I am honestly unsure here.
I'm really confused at the scenarios where role=presentation is needed, other than when you do have aria-label or focusability.
@cschlechty fyi
Yes, the recommendation is to remove role="presentation" in this case. Role presentation is used more for when you want an element that has a specific controlType by default (like <td> or <li>, for example) but you don't want ATs (or the user) to perceive then as that controlType
@ThomasMichon if we do remove role presentation, you were suggesting we'd have regressions if we don't have explicit role in a variety of use cases in fabric itself. Do you have specific cases we should be concerned with?
@dzearing any update on this? Just had this pop up in a semi-related way and I filed 9898 for my specific issue.
I think we should really just remove this. I don't see why FocusZone should ever assume the use case. @ecraig12345 can you please look into removing this?
@ThomasMichon FocusZone should be able to accept a role attribute. Are there cases which absolutely rely on role=presentation that we should explicitly set?
@cschlechty FYI I think we want to fix this.
Just made a PR #10020 removing the role.