Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Jun 8, 2020

adds documentation about focusing inside the sidenav component
Fixes #19450

adds documentation about focusing inside the sidenav component
Fixes #19450
@ghost ghost requested a review from mmalerba as a code owner June 8, 2020 09:56
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 8, 2020
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added docs This issue is related to documentation lgtm action: merge The PR is ready for merge by the caretaker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Jun 8, 2020
#### 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.
Copy link
Contributor

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

@@ -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.
Copy link
Contributor

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 and over mode sidenavs, while it is off by default for the side mode sidenav. You can set it explicitly regardless of the mode using the autoFocus input.

Copy link
Author

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 :)

Copy link
Contributor

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.

Copy link
Author

@ghost ghost Jun 23, 2020

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 and over modes and it is off for side mode. you can change its default behavior by autoFocus input

what do you think about that?

Copy link
Contributor

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

@mmalerba mmalerba removed the action: merge The PR is ready for merge by the caretaker label Jun 8, 2020
@googlebot
Copy link

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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Jul 14, 2020
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Jul 14, 2020
@ghost ghost requested a review from mmalerba July 14, 2020 14:39
@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Jul 14, 2020
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andrewseguin andrewseguin added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Jul 17, 2020
@andrewseguin andrewseguin merged commit 60ce108 into angular:master Jul 17, 2020
ngwattcos pushed a commit to ngwattcos/components that referenced this pull request Jul 20, 2020
…#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>
@mmalerba mmalerba added docs This issue is related to documentation and removed docs This issue is related to documentation labels Aug 4, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2020
@ghost ghost deleted the docs-initial-focus-sidenav branch September 4, 2020 07:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement docs This issue is related to documentation P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document cdkFocusInitial for sidenav
5 participants