-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(focus-trap): update focus trap attrs to camel case #6799 #6960
Conversation
src/cdk/a11y/focus-trap.ts
Outdated
@@ -144,19 +144,24 @@ export class FocusTrap { | |||
* @param bound The boundary to get (start or end of trapped region). | |||
* @returns The boundary element. | |||
*/ | |||
private _getRegionBoundary(bound: 'start' | 'end'): HTMLElement | null { | |||
private _getRegionBoundary(bound: 'Start' | 'End'): HTMLElement | null { |
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.
Can we change this back to 'start'
and 'end'
? I'm pretty sure everywhere else we use string literal types we use all lowercase, we can just convert to upper case in the method
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.
done :)
@@ -68,10 +68,10 @@ | |||
<md-sidenav #focusSidenav> | |||
<md-nav-list> | |||
<a md-list-item routerLink>Link</a> | |||
<a md-list-item routerLink cdk-focus-region-start>Focus region start</a> | |||
<a md-list-item routerLink cdkFocusStart>Focus region start</a> |
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.
cdkFocusRegionStart
<a md-list-item routerLink cdk-focus-initial>Initially focused</a> | ||
<a md-list-item routerLink cdk-focus-region-end>Focus region end</a> | ||
<a md-list-item routerLink cdkFocusInitial>Initially focused</a> | ||
<a md-list-item routerLink cdkFocusEnd>Focus region end</a> |
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.
cdkFocusRegionEnd
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.
- face palm * ---> fixed.
please rebase |
…cus-trap-6799 # Conflicts: # src/demo-app/sidenav/sidenav-demo.html
@mmalerba - done. Noticed that the focus trap is removed from the demo now, is that by design? |
@amcdnl it just moved to the drawer demo: https://github.com/angular/material2/blob/master/src/demo-app/drawer/drawer-demo.html |
@amcdnl rebase? |
@mmalerba - done :) |
And the sidenav demo got moved to the drawer demo, so that needs update as well |
@mmalerba - done |
src/cdk/a11y/focus-trap.ts
Outdated
// Contains the deprecated version of selector, for temporary backwards comparability. | ||
let markers = this._element.querySelectorAll(`[cdk-focus-region-${bound}], ` + | ||
`[cdk-focus-${bound}]`) as NodeListOf<HTMLElement>; | ||
`[cdkFocusRegion${bound}], ` + | ||
`[cdk-focus-${name}]`) as NodeListOf<HTMLElement>; |
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.
name
should be bound
src/cdk/a11y/focus-trap.ts
Outdated
|
||
for (let i = 0; i < markers.length; i++) { | ||
if (markers[i].hasAttribute(`cdk-focus-${bound}`)) { | ||
console.warn(`Found use of deprecated attribute 'cdk-focus-${bound}',` + | ||
` use 'cdk-focus-region-${bound}' instead.`, markers[i]); | ||
` use 'cdkFocusRegion${name}' instead.`, markers[i]); |
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.
name
should be bound
src/cdk/a11y/focus-trap.ts
Outdated
` use 'cdkFocusRegion${name}' instead.`, markers[i]); | ||
} else if (markers[i].hasAttribute(`cdk-focus-region-${bound}`)) { | ||
console.warn(`Found use of deprecated attribute 'cdk-focus-region-${bound}',` + | ||
` use 'cdkFocusRegion${name}' instead.`, markers[i]); |
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.
name
should be bound
Done :) |
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. |
Addresses #6799