-
Notifications
You must be signed in to change notification settings - Fork 78
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(label): allow signposts inside labels #937
base: main
Are you sure you want to change the base?
Conversation
👋 @dtsanevmw,
Thank you, 🤖 Clarity Release Bot |
67ec79b
to
bc86de3
Compare
bc86de3
to
2c719c3
Compare
*/ | ||
@HostListener('click', ['$event']) | ||
onClick(event) { | ||
if (event.target.hasAttribute('clrSignpostTrigger')) { |
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 you add unit tests to validate both branches here (if and else)?
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.
Added in f9c41c0. Thanks!
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.
This doesn't catch all instances and leads to some odd behavior.
- Clicking inside the signpost when opened will cause it to close. The signpost should be able to receive focus and stay open.
- The events within the signpost (close button, click in signpost-content) still bubble up to the label and are not defaulted. I would assume that since clicking the icon itself doesn't bubble up and cause the input/control to be selected, the behavior would be the same for clicking within the signpost itself.
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.
I added a more strict check to prevent that. Actually the click
events were still coming from the label
due to the condition not being met. So when you click inside the signpost
it's again in the label
and label is spreading that to the button
inside signpost
which is closing it.
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.
Much better UX now. Thanks for updating.
7499f97
to
010bb33
Compare
010bb33
to
4d5c056
Compare
@@ -8,7 +8,13 @@ <h1>Angular - {{layout}} - {{ labelSize ? 'grid' : 'no grid' }}</h1> | |||
|
|||
<form clrForm [clrLayout]="layout" [clrLabelSize]="labelSize"> | |||
<clr-checkbox-container> | |||
<label>Checkbox</label> | |||
<label |
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.
Will wait the popover refactor #1435 to be merged |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently if you put signposts inside labels they are not working due to that
<label>
be default is spreading a click event to its children and that's causing the signpost to automatically close and not appear.Example:
If you have a label attached to an input or input inside a label and click the label - the input will get focused.
Issue Number: CDE-9 and #271
What is the new behavior?
Signposts are now working inside
<label>
.Does this PR introduce a breaking change?
Other information