-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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(material-experimental/mdc-chips): don't use button element if chip row isn't editable #25327
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crisbeto
added
P2
The issue is important to a large percentage of users, with a workaround
G
This is is related to a Google internal issue
target: patch
This PR is targeted for the next patch release
labels
Jul 22, 2022
…p row isn't editable Currently we always use a `button` element inside the `mat-chip-row` which can be confusing for users if the row isn't editable, because the button won't do anything. These changes switch to using a `span` whose `role` we toggle based on whether it's editable. The change ended up trickier than expected, because: 1. The focus behavior of the `span` is slightly different from the button we had before. 2. The focus restoration after an edit is finished is currently working by accident. When editing starts, we set `isInteractive = false` on the primary action which clears its `tabindex`. When editing is finished, we reset the flag, but change detection hasn't had the chance to run so the element won't actually have a `tabindex` at the moment when we try to restore focus. It worked by accident because a `button` is still focusable even without a `tabindex`. An alternative approach I was testing out was to swap between a `span` and `button` element based on the `editable` input, but that didn't work, because we have a `ViewChild` query for the primary action which wasn't being updated by the framework.
crisbeto
force-pushed
the
mdc-chips-button
branch
from
July 22, 2022 09:57
de9a441
to
54ef8a0
Compare
devversion
approved these changes
Jul 25, 2022
crisbeto
added a commit
that referenced
this pull request
Jul 25, 2022
…p row isn't editable (#25327) Currently we always use a `button` element inside the `mat-chip-row` which can be confusing for users if the row isn't editable, because the button won't do anything. These changes switch to using a `span` whose `role` we toggle based on whether it's editable. The change ended up trickier than expected, because: 1. The focus behavior of the `span` is slightly different from the button we had before. 2. The focus restoration after an edit is finished is currently working by accident. When editing starts, we set `isInteractive = false` on the primary action which clears its `tabindex`. When editing is finished, we reset the flag, but change detection hasn't had the chance to run so the element won't actually have a `tabindex` at the moment when we try to restore focus. It worked by accident because a `button` is still focusable even without a `tabindex`. An alternative approach I was testing out was to swap between a `span` and `button` element based on the `editable` input, but that didn't work, because we have a `ViewChild` query for the primary action which wasn't being updated by the framework. (cherry picked from commit e383efd)
crisbeto
added a commit
that referenced
this pull request
Jul 25, 2022
…p row isn't editable (#25327) Currently we always use a `button` element inside the `mat-chip-row` which can be confusing for users if the row isn't editable, because the button won't do anything. These changes switch to using a `span` whose `role` we toggle based on whether it's editable. The change ended up trickier than expected, because: 1. The focus behavior of the `span` is slightly different from the button we had before. 2. The focus restoration after an edit is finished is currently working by accident. When editing starts, we set `isInteractive = false` on the primary action which clears its `tabindex`. When editing is finished, we reset the flag, but change detection hasn't had the chance to run so the element won't actually have a `tabindex` at the moment when we try to restore focus. It worked by accident because a `button` is still focusable even without a `tabindex`. An alternative approach I was testing out was to swap between a `span` and `button` element based on the `editable` input, but that didn't work, because we have a `ViewChild` query for the primary action which wasn't being updated by the framework. (cherry picked from commit e383efd)
crapStone
pushed a commit
to Calciumdibromid/CaBr2
that referenced
this pull request
Aug 9, 2022
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@angular/cdk](https://github.com/angular/components) | dependencies | patch | [`14.1.0` -> `14.1.1`](https://renovatebot.com/diffs/npm/@angular%2fcdk/14.1.0/14.1.1) | | [@angular/material](https://github.com/angular/components) | dependencies | patch | [`14.1.0` -> `14.1.1`](https://renovatebot.com/diffs/npm/@angular%2fmaterial/14.1.0/14.1.1) | --- ### Release Notes <details> <summary>angular/components</summary> ### [`v14.1.1`](https://github.com/angular/components/blob/HEAD/CHANGELOG.md#​1411-moissanite-mango-2022-08-03) [Compare Source](angular/components@14.1.0...14.1.1) ##### cdk | Commit | Type | Description | | -- | -- | -- | | [251c9abdf](angular/components@251c9ab) | fix | **dialog:** use config injector if provided ([#​25332](angular/components#25332)) | | [636dd60ee](angular/components@636dd60) | fix | **drag-drop:** expose pickup position in constrainPosition callback ([#​25341](angular/components#25341)) | | [aea1a5d67](angular/components@aea1a5d) | fix | **overlay:** detach overlay when portal is destroyed from the outside ([#​25212](angular/components#25212)) | | [63ca33bc8](angular/components@63ca33b) | fix | **schematics:** strip bom from sass files ([#​25364](angular/components#25364)) | ##### material-experimental | Commit | Type | Description | | -- | -- | -- | | [e045e8d49](angular/components@e045e8d) | fix | **mdc-chips:** don't use button element if chip row isn't editable ([#​25327](angular/components#25327)) | | [394b93f18](angular/components@394b93f) | fix | **mdc-slider:** skip resizing while the user is dragging ([#​25318](angular/components#25318)) | #### Special Thanks Amadou Sall, Kristiyan Kostadinov, Paul Gschwendtner and Serge <!-- CHANGELOG SPLIT MARKER --> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNDEuMCIsInVwZGF0ZWRJblZlciI6IjMyLjE0MS4wIn0=--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Co-authored-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1491 Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
This was referenced Aug 9, 2022
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. |
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
G
This is is related to a Google internal issue
P2
The issue is important to a large percentage of users, with a workaround
target: patch
This PR is targeted for the next patch release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we always use a
button
element inside themat-chip-row
which can be confusing for users if the row isn't editable, because the button won't do anything.These changes switch to using a
span
whoserole
we toggle based on whether it's editable.The change ended up trickier than expected, because:
span
is slightly different from the button we had before.isInteractive = false
on the primary action which clears itstabindex
. When editing is finished, we reset the flag, but change detection hasn't had the chance to run so the element won't actually have atabindex
at the moment when we try to restore focus. It worked by accident because abutton
is still focusable even without atabindex
.An alternative approach I was testing out was to swap between a
span
andbutton
element based on theeditable
input, but that didn't work, because we have aViewChild
query for the primary action which wasn't being updated by the framework.