Skip to content

Commit

Permalink
allow details element to be toggled inside selection and focus zones
Browse files Browse the repository at this point in the history
Added an exception for <details> the same as we have for buttons, inputs,
and other interactive elements.
  • Loading branch information
spmonahan committed Oct 20, 2022
1 parent 1646df5 commit d851827
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 === 'DETAILS'
) {
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 === 'DETAILS')
) {
return false;
} else if (target === itemRoot) {
Expand Down

0 comments on commit d851827

Please sign in to comment.