Skip to content

Commit

Permalink
fix: update internal usage of useModalAttributes to use legacyTrapFoc…
Browse files Browse the repository at this point in the history
…us by default (#31801)
  • Loading branch information
smhigley authored Jun 28, 2024
1 parent 286ef61 commit b26b475
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "feat: update DatePicker to use legacyTrapFocus",
"packageName": "@fluentui/react-datepicker-compat",
"email": "sarah.higley@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "docs: update wording for legacyTrapFocus",
"packageName": "@fluentui/react-tabster",
"email": "sarah.higley@microsoft.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export const useDatePicker_unstable = (props: DatePickerProps, ref: React.Ref<HT
root.onFocus = useEventCallback(mergeCallbacks(root.onFocus, onInputFocus));
root.onClick = useEventCallback(mergeCallbacks(root.onClick, onInputClick));

const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: false });
const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: true });
const popupSurface = open
? slot.optional(props.popupSurface, {
renderByDefault: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ import { useTabster } from './useTabster';
export interface UseModalAttributesOptions {
/**
* Traps focus inside the elements the attributes are applied.
* Prefer this to `legacyTrapFocus`
* it forbids users to tab out of the focus trap into the actual browser.
*/
trapFocus?: boolean;

/**
* Traps focus inside the elements the attributes are applied.
* This prop enables legacy behavior to match previous versions of Fluent and is not
* recommended for general use.
* Enabling `legacyTrapFocus` prevents users from tabbing out of the focus trap and into
* the actual browser. Prefer using `trapFocus` instead of this prop.
* This prop enables traditional force-focus behavior to match previous versions of Fluent.
* Without this, users can tab out of the focus trap and into the browser chrome.
* This matches the behavior of the native <dialog> element and inert.
* We recommend setting this to true based on user feedback and consistency.
*/
legacyTrapFocus?: boolean;

Expand Down

0 comments on commit b26b475

Please sign in to comment.