-
Notifications
You must be signed in to change notification settings - Fork 6.8k
docs(material/sidenav): Document cdkFocusInitial for sidenav #19564
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
Conversation
adds documentation about focusing inside the sidenav component Fixes #19450
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ocs-initial-focus-sidenav
src/material/sidenav/sidenav.md
Outdated
#### Focus management | ||
The sidenav captures focus automatically by default, unless it's in the side mode. Focus capturing can be enabled or disabled explicitly, using the `autoFocus` input. | ||
|
||
By default the first tabbable element will recieve focus upon open. If you want a different element to be focused, you can set the cdkFocusInitial attribute on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Please add backquotes around cdkFocusInitial
src/material/sidenav/sidenav.md
Outdated
@@ -209,6 +209,11 @@ Similarly, the `<mat-sidenav-content>` should be given a role based on what it c | |||
represents the primary content of the page, it may make sense to mark it `role="main"`. If no more | |||
specific role makes sense, `role="region"` is again a good fallback. | |||
|
|||
#### Focus management | |||
The sidenav captures focus automatically by default, unless it's in the side mode. Focus capturing can be enabled or disabled explicitly, using the `autoFocus` input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about this? I think it makes it just a little bit easier to follow
The sidenav has the ability to capture focus automatically. This behavior is turned on by default for the
push
andover
mode sidenavs, while it is off by default for theside
mode sidenav. You can set it explicitly regardless of the mode using theautoFocus
input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, the older version is a bit laconic. Also it only talks about autoFocus property, without adding knowledge about sidenav mode definitions. Said so, you're version is better in flow. The sentences flow one after another smoothly.
In conclusion, I would still leave my version :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In particular, I don't like the phrase "automatically by default". I understand what you're trying to say, but its confusing because people often use the "automatically" to mean "by default".
only talks about autoFocus property, without adding knowledge about sidenav mode definitions
I think we should mention the other modes explicitly, its easier to understand when you tell people what modes do have this behavior rather than (or in addition to) which ones don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sidenav has the ability to capture focus. This behavior is turned on for
push
andover
modes and it is off forside
mode. you can change its default behavior byautoFocus
input
what do you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that. It's succinct and addresses the concerns I had
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…#19564) * docs(material/sidenav): Document cdkFocusInitial for sidenav adds documentation about focusing inside the sidenav component Fixes angular#19450 * cdkFocusInitial sentence rephrased * sidenav autoFocus explained in details * sidenav focus statement rephrased * gramma error fixed * rephrased autoFocus sentence * Update sidenav.md Co-authored-by: mmalerba <mmalerba@google.com>
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
adds documentation about focusing inside the sidenav component
Fixes #19450