4565 clear inherited aria-label on ic-navigation-button when attribute is removed#4566
Open
jb97991 wants to merge 1 commit into
Open
Conversation
…on when attribute is removed hostMutationCallback only updated inheritedAttributes when the new attribute value was truthy, so removing/clearing a mutable attribute (e.g. aria-label set by a child ic-badge) was never detected. This left ic-navigation-button permanently displaying a stale accessible name even after the attribute had been cleared. Now the callback also deletes the corresponding key from inheritedAttributes and forces a re-render when the attribute is removed, so the component correctly falls back to its own label prop.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of the changes
ic-navigation-button'shostMutationCallbackonly updated its cachedinheritedAttributeswhen a mutated attribute's new value was truthy. This meant that when a childic-badgecleared its parent'saria-label, the stale value was never removed frominheritedAttributes, causing the button to permanently display an outdated accessible name/tooltip.This PR updates the callback to also delete the corresponding key from
inheritedAttributeswhen an attribute is removed/cleared, and ensures a re-render is triggered in both cases (set and cleared), so the component correctly falls back to its ownlabelprop once the override is gone.Related issue
#4565