Re: [whatwg/dom] Atomic move operation for element reparenting & reordering (Issue #1255)

> It seems like this API raises a lot of open questions.

Sure, happy to work through them and flesh them out.
 
> What does it mean, for example, for focus to be preserved. Would it mean that the focused element will continue to retain the focus regardless of whether it's moved to? It would mean that a bunch of old ancestors will need to receive `focusout` events & new ancestors will need to receive `focusin` events.

In the blink prototype we currently don't send these events. But it's a choice, and we can spec and implement firing these events. There's not much complexity in this, just some judgement calls.

> 
> Preserving selection will be even funkier. Since Blink & WebKit don't support discontiguous selection so we can probably only able to preserve the end points of selection. Then the a bunch of nodes in-between old positions of start and end will be deselected, and a bunch of nodes in-between new positions of start and end will be newly selected. We most certainly need to fire `selecionchange` event in that scenario because the bunch of nodes have changed its selection state.

You mean if a node that's in the beginning/end of the range is moved to where the range now extends to additional/fewer elements? Yes we should probably fire `selectionchange` at that time.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1255#issuecomment-2312011069
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1255/2312011069@github.com>

Received on Tuesday, 27 August 2024 09:26:41 UTC