-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Chip] Add clickable
property
#11613
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
067e968
Fixed Chip should be styled clickable when component is
ce3d7bb
Fixed Review comments
550f728
Fixed Review comments
c0c4114
Added info in Doc
fd65f3a
Changed comments and added an example
77d4424
Added API doc
f834c8a
Added link to clickable chip
ac3ed14
Rearranged the props
8a0645d
Moved the chip to last of list
0a9867f
Removed Underlining of text in Link chip
7bd5c43
Made clickable chips accessible through keyboard
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
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.
Should the
clickable
property have a higher priority than theonClick
detection logic?Meaning, what's the output of
<Chip clickable={false} onClick={() => ()} />
?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.
@oliviertassinari I feel clickable should have low priority than OnClick. The output of above will still be clickable as per the below code:
{ [classes.clickable]: onClick || clickable },
if onclick is present, it will be clickable at any cost. Only when onClick is not present, clickable comes into the picture.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.
@oliviertassinari This is only affecting the styling (and the description should perhaps reflect that), but requiring the prop to be set in order for a Chip with onClick to appear clickable seems counter-intuitive to me.
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.
@mbrookes I was asking the question in a context where
defaultProps.clickable = 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.
Ah, I see. So being able to set
clickable={somethingFalse}
when a Chip has anonClick()
handler but other conditions mean that it won't act on the click?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.
@oliviertassinari I feel defaultProps.clickable = null also would work fine. still false makes better sense, as we have kept props type as boolean. Also, in terms of functionality, nothing changes in either way
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.
@mbrookes Couldn't understand your question clearly. But to explain, if we have 'onClick' hander, 'clickable' doesn't affect and the chip is always clickable. when 'onClick' is not present, then the value of 'clickable' determine if the chip is clickable
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.
@vilvaathibanpb I was just clarifying with @oliviertassinari if I understood correctly the benefit of
defaultProps.clickable = null
combined with clickable having priority.Let me rephrase it as a direct question: @oliviertassinari What do you see as the main benefit for
null
as the default?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.
The advantage is that it's allowing people to control the clickable state, but still, being able to rely on the onClick detection logic if they wish. But I'm fine either way. The current approach is simple too.