mirror of
https://github.com/we-promise/sure.git
synced 2026-09-03 13:51:29 +00:00
feat(icons): add search field for icon selection (#2862)
* feat(icons): add search field for icon selection * fix(icons): address review suggestions on the icon picker * fix(goals): prevent the icon picker popover from collapsing `updatePopupPosition` sets `bottom: 0px` when the popover would run past the fold, but never clears Tailwind's `top-full`. With both offsets set and `height: auto`, CSS derives the height from the offsets instead of the content, collapsing the popover to 26px. This PR is what makes it reachable: the search row (42px plus an 8px gap) and the grid going max-h-40 -> max-h-52 grow the popover ~98px, moving the overflow trigger point far enough to hit standalone /goals/new at 1280x800. `h-fit` makes the height non-auto, so the over-constraint resolves by ignoring `bottom`, which is why categories, already carrying it, was never affected.
This commit is contained in:
@@ -8,6 +8,29 @@ export default class extends Controller {
|
||||
this.inputTarget.focus();
|
||||
this.highlightedIndex = -1;
|
||||
this.updateAriaActiveDescendant();
|
||||
|
||||
this.hostDetails = this.element.closest("details");
|
||||
if (this.hostDetails) {
|
||||
this._onHostToggle = () => {
|
||||
if (this.hostDetails.open) {
|
||||
this.inputTarget.focus();
|
||||
} else {
|
||||
this.reset();
|
||||
}
|
||||
};
|
||||
this.hostDetails.addEventListener("toggle", this._onHostToggle);
|
||||
}
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
if (this.hostDetails) {
|
||||
this.hostDetails.removeEventListener("toggle", this._onHostToggle);
|
||||
}
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.inputTarget.value = "";
|
||||
this.filter();
|
||||
}
|
||||
|
||||
filter() {
|
||||
@@ -118,7 +141,9 @@ export default class extends Controller {
|
||||
clearHighlights() {
|
||||
this.listTarget.querySelectorAll(".filterable-item").forEach((item) => {
|
||||
item.classList.remove("bg-container-inset-hover");
|
||||
item.setAttribute("aria-selected", "false");
|
||||
if (item.hasAttribute("aria-selected")) {
|
||||
item.setAttribute("aria-selected", "false");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user