Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update internal usage of useModalAttributes to use legacyTrapFocus by default #31801

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "[email protected]",
"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": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,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
Loading