Skip to content

Commit 069ad4f

Browse files
committed
feat(Modal): remove autoFocus prop
BREAKING CHANGE: The modal now focuses the first focusable element by default. Therefore, the autoFocus prop is no longer needed
1 parent 5f9e211 commit 069ad4f

File tree

3 files changed

+0
-7
lines changed

3 files changed

+0
-7
lines changed

packages/orbit-components/src/Modal/Modal.stories.tsx

-5
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ export const RemovableSections: Story = {
274274
"size",
275275
"title",
276276
"mobileHeader",
277-
"autoFocus",
278277
"isMobileFullPage",
279278
"preventOverlayClose",
280279
"hasCloseButton",
@@ -323,7 +322,6 @@ export const WithFixedFooter: Story = {
323322
"size",
324323
"title",
325324
"mobileHeader",
326-
"autoFocus",
327325
"isMobileFullPage",
328326
"preventOverlayClose",
329327
"hasCloseButton",
@@ -403,7 +401,6 @@ export const WithForm: Story = {
403401
"size",
404402
"title",
405403
"mobileHeader",
406-
"autoFocus",
407404
"isMobileFullPage",
408405
"preventOverlayClose",
409406
"hasCloseButton",
@@ -494,7 +491,6 @@ export const WithModalHeaderOnly: Story = {
494491
"size",
495492
"fixedFooter",
496493
"title",
497-
"autoFocus",
498494
"isMobileFullPage",
499495
"preventOverlayClose",
500496
"hasCloseButton",
@@ -577,7 +573,6 @@ export const Playground: StoryObj<PlaygroundStoryProps> = {
577573
hasCloseButton: true,
578574
disableAnimation: false,
579575
labelClose: "Close",
580-
autoFocus: true,
581576
header: true,
582577
footer: true,
583578
id: "modal-id",

packages/orbit-components/src/Modal/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Table below contains all types of the props available in the Modal component.
3636
| onClose | `event => void \| Promise` | | Function for handling onClose event. If you don't pass any function the Close button will not be displayed and it will not be possible to close the Modal. [See Functional specs](#functional-specs). |
3737
| preventOverlayClose | `boolean` | | Property for preventing closing of modal when there is a action on overlay. BEWARE: This should be used only in very specials edge-cases! It breaks user experience. |
3838
| hasCloseButton | `boolean` | `true` | Defines whether the Modal displays a close button. If you disable this, we recommend adding some kind of an alternative. |
39-
| autoFocus | `boolean` | `true` | The autofocus attribute of the Modal, see [this docs](https://www.w3schools.com/tags/att_autofocus.asp). |
4039
| disableAnimation | `boolean` | `false` | Defines whether the Modal performs the slide in animation on mobile. If you want to improve your [CLS](https://web.dev/cls/) score, you might want to set this to `true`. |
4140
| mobileHeader | `boolean` | `true` | If `false` the ModalHeader will not have MobileHeader and CloseContainer. |
4241
| labelClose | `string` | `Close` | The label for the close button. |

packages/orbit-components/src/Modal/types.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export interface Props extends Common.Globals {
1313
readonly triggerRef?: React.RefObject<HTMLElement>;
1414
readonly lockScrolling?: boolean;
1515
readonly scrollingElementRef?: React.Ref<HTMLElement>;
16-
readonly autoFocus?: boolean;
1716
readonly onClose?: Common.Event<
1817
| React.KeyboardEvent<HTMLDivElement>
1918
| React.SyntheticEvent<HTMLButtonElement | HTMLDivElement | HTMLAnchorElement>

0 commit comments

Comments
 (0)