mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-11 12:18:59 +00:00
fix(bitrix24): make pending-portal delete button clickable in Radix Select [B24:2794] (#1431)
The delete affordance next to each pending portal in the channel-create form was wired to onClick, but Radix Select closes the popover on the SelectItem's own pointerdown handler. By the time the click event would fire on the nested button, the popover — and the button — are gone. onPointerDown on the button additionally called e.preventDefault(), which further blocked the browser from synthesising the click at all. Result: clicking the trash icon looked completely dead. Keyboard users were already covered by the Delete/Backspace onKeyDown handler on the SelectItem itself; only mouse users were locked out. Fire setPendingDeleteName from onPointerDown (with stopPropagation + preventDefault so the parent SelectItem doesn't also select the pending portal), and keep the onClick handler so the button stays activatable by Enter/Space when it takes focus. This mirrors the pattern Radix uses for its own nested interactive elements (e.g. DropdownMenu.CheckboxItem). Surface parity: - Gateway server: N/A because the change is UI-only. - API contract: N/A because bitrix.portals.delete already exists. - Web UI: the single component that owned the broken handler. - CLI/runtime: N/A because no CLI reads this UI state. Co-authored-by: DangTinh311 <dangtinh31193@gmail.com>
This commit is contained in:
1 parent
fec70a7910
commit
143ed4a8a4
1 file changed
+7
@@ -150,9 +150,16 @@ export function BitrixPortalSelect({ value, onChange, onCreateRequest, onResumeA
|
||||
type="button"
|
||||
aria-label={t("bitrix24.portalSelect.deleteAria", { name: p.name, defaultValue: `Delete portal ${p.name}` })}
|
||||
className="ml-auto rounded p-1 text-muted-foreground hover:text-destructive"
|
||||
// Trigger on pointerdown, not click: Radix Select closes
|
||||
// the popover on the SelectItem's own pointerdown, so
|
||||
// by the time click fires the item is gone. stopPropagation
|
||||
// keeps the parent SelectItem from selecting the pending
|
||||
// portal; the paired click handler stays for keyboard-
|
||||
// driven activation (Enter/Space on focused button).
|
||||
onPointerDown={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
setPendingDeleteName(p.name);
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in new issue
Block a user