-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(select): add alternate rendering strategy for improved accessibility #14430
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
@jelbourn a few things that are up in the air:
|
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
1 similar comment
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
11e6b33
to
141c534
Compare
Per open questions:
|
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.
High level- I don't quite follow why the new type of portal is necessary. What's the rundown of this approach vs. just visually the existing overlay?
src/cdk/portal/portal.ts
Outdated
} | ||
|
||
/** DOM node hosting the portal's content. */ | ||
get origin(): 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.
element
?
src/lib/select/select.html
Outdated
[style.transformOrigin]="_transformOrigin" | ||
[style.font-size.px]="_triggerFontSize" | ||
(keydown)="_handleKeydown($event)"> | ||
<ng-content></ng-content> |
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 avoid doing the "ng-content inside ng-template` trick? It ends up always instantiating the content, even when it's not going to be attached.
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.
We could make it work by allowing people to provide an ng-template
as the content. The problem is that we need the content to be rendered, in order to know what the options inside the select are. We need to know the options for a lot of things like showing the selected value, knowing where to position the dropdown, supporting keyboard navigation while closed etc.
@jelbourn I'll go through the rest of the feedback. As for the reason why I introduced a new portal, it's because it makes it easier to switch between the two approaches and it's much more aligned with the rest of our setup. The alternative would be something like the approach in #11806 where we'd need to support multiple parallel code paths. |
141c534
to
cabdc2b
Compare
@jelbourn all the feedback should be addressed now. |
cabdc2b
to
f3ffda0
Compare
@jelbourn the changes that we've discussed should be implemented now, can you take another look? |
f3ffda0
to
79bf5a9
Compare
77879e3
to
a2fa363
Compare
a2fa363
to
223e2ff
Compare
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
…lity Currently `mat-select` has some accessibility issues, because we don't keep the options in the DOM until the select is attached, making it harder for assistive technology to pick it up. These changes add an alternate, opt-in, rendering strategy that'll keep the options inside the DOM. The rendering strategy is controlled through the `MAT_SELECT_RENDERING_STRATEGY` injection token. In order to facilitate the new rendering strategy, these changes introduce a new kind of portal called an `InlinePortal`. It is a portal whose content is transferred from one place in the DOM to another when it is attached/detached. Another change that was necessary for the new rendering to work was being able to pass a portal to the `CdkConnectedOverlay` directive. If no portal is passed, the directive will fall back to the current behavior.
223e2ff
to
aeaf07d
Compare
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
There is no mention here about presubmit failures or issues, but #11083 (comment) mentions
@jelbourn has this been presubmitted again after the May 2019 updates? If so, can you please confirm that this needs to be considered for closing due to too many presubmit failures? |
Right- this change was unfortunately too breaking to land for existing Google apps. The new plan is bake the improvements into the MDC-based select component. |
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for angular#14430.
Adds a new type of portal called `DomPortal` which transfers the contents of a portal into the portal outlet and then restores them on destroy. This was implemented initially for #14430.
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. |
Currently
mat-select
has some accessibility issues, because we don't keep the options in the DOM until the select is attached, making it harder for assistive technology to pick it up. These changes add an alternate, opt-in, rendering strategy that'll keep the options inside the DOM. The rendering strategy is controlled through theMAT_SELECT_RENDERING_STRATEGY
injection token.In order to facilitate the new rendering strategy, these changes introduce a new kind of portal called an
InlinePortal
. It is a portal whose content is transferred from one place in the DOM to another when it is attached/detached.Another change that was necessary for the new rendering to work was being able to pass a portal to the
CdkConnectedOverlay
directive. If no portal is passed, the directive will fall back to the current behavior.