BREAKING: Remove Button's tooltipGapSize prop#671
Merged
frankieyan merged 1 commit intomainfrom Aug 15, 2022
Merged
Conversation
pedroalves0
approved these changes
Jul 1, 2022
7 tasks
3817a05 to
8670017
Compare
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.
Short description
The
tooltipGapSizebutton prop was introduced in #636, but was challenged shortly afterwards, as not being a good course of action. See #636 (comment).However, the reason for needing it was related to the fact that icon-only buttons are too aggressive in assuming they should use the
aria-labelfor the tooltip if no tooltip is given. This PR makes it so that icon-only buttons only fall back to usearia-labelas tooltip if the tooltip is really omitted (that is, the prop is not given at all, or given with valueundefined). If thetooltipprop is given, but with a falsy/empty value, the implicit tooltip is now omitted, allowing consumers of the button to fully own the rendering of the tooltip, or to really suppress it if they really want to (with great power comes great responsibility).So, from now on, instead of this:
We should use this:
However, the most common use case (not needing to customize the tooltip), remains as simple as ever:
Or customizing only the tooltip content, but nothing else:
PR Checklist
npm run validateand made sure no errors / warnings were shownCHANGELOG.mdpackage.jsonandpackage-lock.json(npm --no-git-tag-version version <major|minor|patch>) refnpm run build-all)Versioning
This is a breaking change, which implies a new major version release.