🌐 AI搜索 & 代理 主页
Skip to content

Commit e041a16

Browse files
authored
Update README.md
1 parent 9af631d commit e041a16

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/components/modal/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,18 @@ focus a form control when the modal opens. Note that the `autofocus` prop will n
999999
`b-modal` if the `static` prop is used without the `lazy` prop set, as `autofocus` happens when the
10001000
`b-form-*` controls are _mounted in the DOM_.
10011001

1002-
**Note:** it is **not recommended** to autofocus an input inside a modal for accessibility reasons,
1003-
as screen reader users will not know the context of where the input is. It is best to let
1004-
`<b-modal>` focus the modal's container and then allow the user to tab into the input.
1002+
If you want to auto focus one of the _built-in_ modal buttons (`ok`, `cancel` or the header `close`
1003+
button, you can set the prop `auto-focus-button` to one of the values `'ok'`, `'cancel'` or `'close'`
1004+
and `<b-modal>` will focus the specified button if it exists. This feature is also available for
1005+
modal message boxes.
1006+
1007+
<p class="alert alert-warning">
1008+
<strong>Note:</strong> it is <strong>not recommended</strong> to autofocus an input or control
1009+
inside of a modal for accessibility reasons, as screen reader users will not know the context of
1010+
where the input is (the announcment of the modal may not be spoken). It is best to let
1011+
<code>&lt;b-modal&gt;</code> focus the modal's container, allowing the modal information to be
1012+
spoken to the user, and then allow the user to tab into the input.
1013+
</p>
10051014

10061015
### Returning focus to the triggering element
10071016

0 commit comments

Comments
 (0)