writing.exchange is one of the many independent Mastodon servers you can use to participate in the fediverse.
A small, intentional community for poets, authors, and every kind of writer.

Administered by:

Server stats:

334
active users

#caret

0 posts0 participants0 posts today

In Safari, tabbing to a non-editable element destroys the current selection range.

That's bad enough, but get this -- the reset has *already happened* when the `focus` event fires, so we can't snapshot the data because it's already lost. And yet the resulting `selectionchange` event **hasn't** fired yet, so we can't use that event to filter-out the change.

Are you fucking kidding me??

Writing #javascript to handle #caret browsing is interesting.

Since `keydown` only fires for targets that can be `activeElement`, the event target from caret navigating plain text is always <body>.

However you can identify which element contains the caret, by evaluating the range data, which you can also do from `selectionchange` events.

And get this -- Safari still fires those events, even though it doesn't support caret browsing ... because it actually does, it just doesn't show the caret!