Skip to content

Commit

Permalink
allow details element to be toggled inside selection and focus zones (m…
Browse files Browse the repository at this point in the history
…icrosoft#25324)

* allow details element to be toggled inside selection and focus zones

Added an exception for <details> the same as we have for buttons, inputs,
and other interactive elements.

* update detailslist details focus/toggle

Change the exception from the `details` tag to the `summary` tag as the
latter is what actually receives focus events.
  • Loading branch information
spmonahan authored and NotWoods committed Nov 18, 2022
1 parent edda591 commit 78a1d56
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: add support for HTML defails element",
"packageName": "@fluentui/react",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: add support for HTML details element",
"packageName": "@fluentui/react-focus",
"email": "seanmonahan@microsoft.com",
"dependentChangeType": "patch"
}
3 changes: 2 additions & 1 deletion packages/react-focus/src/components/FocusZone/FocusZone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,8 @@ export class FocusZone extends React.Component<IFocusZoneProps> implements IFocu
target.tagName === 'BUTTON' ||
target.tagName === 'A' ||
target.tagName === 'INPUT' ||
target.tagName === 'TEXTAREA'
target.tagName === 'TEXTAREA' ||
target.tagName === 'SUMMARY'
) {
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/utilities/selection/SelectionZone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,10 @@ export class SelectionZone extends React.Component<ISelectionZoneProps, ISelecti
} else if (
// eslint-disable-next-line deprecation/deprecation
(ev.which === KeyCodes.enter || ev.which === KeyCodes.space) &&
(target.tagName === 'BUTTON' || target.tagName === 'A' || target.tagName === 'INPUT')
(target.tagName === 'BUTTON' ||
target.tagName === 'A' ||
target.tagName === 'INPUT' ||
target.tagName === 'SUMMARY')
) {
return false;
} else if (target === itemRoot) {
Expand Down

0 comments on commit 78a1d56

Please sign in to comment.