mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
Add client-hosted row support to floating panel drag-to-reorder
- Include `[data-client-hosted-browser-row-id]` in no-drag selectors alongside other tab types - Broaden type check from HTMLElement to Element for better SVG support - Add test coverage for client-hosted rows and SVG icon interactions
This commit is contained in:
+4
-4
@@ -1,9 +1,9 @@
|
||||
/** Interactive chrome living inside the draggable titlebar. `[data-tab-id]` covers
|
||||
* every tab kind (terminal, browser, editor, simulator, client-hosted row): a press
|
||||
/** Interactive chrome living inside the draggable titlebar. `[data-tab-id]` and the
|
||||
* client-hosted row marker cover every tab kind: a press
|
||||
* on a tab starts a dnd-kit reorder, so it must never also move the panel. */
|
||||
const FLOATING_TERMINAL_NO_DRAG_SELECTOR =
|
||||
'button,input,textarea,select,[role="menuitem"],[data-tab-id],[data-floating-terminal-no-drag]'
|
||||
'button,input,textarea,select,[role="menuitem"],[data-tab-id],[data-client-hosted-browser-row-id],[data-floating-terminal-no-drag]'
|
||||
|
||||
export function isFloatingTerminalDragTarget(target: EventTarget): boolean {
|
||||
return !(target instanceof HTMLElement && target.closest(FLOATING_TERMINAL_NO_DRAG_SELECTOR))
|
||||
return !(target instanceof Element && target.closest(FLOATING_TERMINAL_NO_DRAG_SELECTOR))
|
||||
}
|
||||
|
||||
+11
-1
@@ -172,7 +172,7 @@ describe('floating workspace tab reorder', () => {
|
||||
})
|
||||
|
||||
describe('floating panel titlebar drag target', () => {
|
||||
it.each(['sortable-tab', 'browser-tab', 'editor-tab'])(
|
||||
it.each(['sortable-tab', 'browser-tab', 'editor-tab', 'client-hosted-browser-row-id'])(
|
||||
'does not move the panel when the press lands on a %s',
|
||||
(kind) => {
|
||||
const tab = document.createElement('div')
|
||||
@@ -186,6 +186,16 @@ describe('floating panel titlebar drag target', () => {
|
||||
}
|
||||
)
|
||||
|
||||
it('does not move the panel when a tab SVG icon receives the press', () => {
|
||||
const tab = document.createElement('div')
|
||||
tab.dataset.tabId = 'terminal-tab'
|
||||
const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
|
||||
tab.appendChild(icon)
|
||||
document.body.appendChild(tab)
|
||||
|
||||
expect(isFloatingTerminalDragTarget(icon)).toBe(false)
|
||||
})
|
||||
|
||||
it('still moves the panel from bare titlebar chrome', () => {
|
||||
const titlebar = document.createElement('div')
|
||||
document.body.appendChild(titlebar)
|
||||
|
||||
Reference in New Issue
Block a user