Bug description
The clear button plugin only toggles visibility with opacity (0 when hidden, 1 on .focus.has-items / hover):
.clear-button {
opacity: 0;
position: absolute;
cursor: pointer;
...
}
It never sets pointer-events: none. The button is absolutely positioned right next to the caret/dropdown-toggle area, and stays clickable even while invisible (opacity 0 does not disable pointer events). It also keeps cursor: pointer while invisible, so hovering that spot shows a hand cursor - making the user think there's something clickable there, even though visually it looks like part of the plain control.
So a click near the caret - meant to just open the dropdown - can land on the hidden clear button instead. When that happens, nothing appears to work: the click doesn't open the dropdown, because clear_button's handler calls self.clear() (no items, so it's a no-op) and, since the button is a <div tabindex="0">, the mousedown also shifts browser focus to it. That fires onBlur on the control, which calls self.close() - closing/keeping the dropdown closed. From the user's side, the hand cursor promised something clickable, then the click just did nothing.
Expected behavior
Fix we're using locally, mirroring the same conditions the plugin already uses for opacity:
.clear-button {
pointer-events: none;
}
&.focus.has-items .clear-button,
&:not(.disabled):hover.has-items .clear-button {
pointer-events: auto;
}
This keeps the button clickable (and its hand cursor honest) only when it's actually visible, so clicks/hover in that area otherwise pass through to the control as expected.
Steps to reproduce
- Go to clear-button example
- Go to the "Select Single" example and klick on the non visible "clear button"
- Dropdown is not opend
- Go to clear-button example
- Select any value in the "Select Single" example
- Click on the clear button and do not move the mouse.
- Element is removed
- Click again
- Dropdown is not opend
Additional context
Version 2.6.2
Bug description
The clear button plugin only toggles visibility with opacity (0 when hidden, 1 on .focus.has-items / hover):
It never sets pointer-events: none. The button is absolutely positioned right next to the caret/dropdown-toggle area, and stays clickable even while invisible (opacity 0 does not disable pointer events). It also keeps cursor: pointer while invisible, so hovering that spot shows a hand cursor - making the user think there's something clickable there, even though visually it looks like part of the plain control.
So a click near the caret - meant to just open the dropdown - can land on the hidden clear button instead. When that happens, nothing appears to work: the click doesn't open the dropdown, because clear_button's handler calls
self.clear()(no items, so it's a no-op) and, since the button is a<div tabindex="0">, the mousedown also shifts browser focus to it. That firesonBluron the control, which callsself.close()- closing/keeping the dropdown closed. From the user's side, the hand cursor promised something clickable, then the click just did nothing.Expected behavior
Fix we're using locally, mirroring the same conditions the plugin already uses for opacity:
This keeps the button clickable (and its hand cursor honest) only when it's actually visible, so clicks/hover in that area otherwise pass through to the control as expected.
Steps to reproduce
Additional context
Version 2.6.2