siblingpastry, (edited )
@siblingpastry@mastodon.world avatar

Writing to handle 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!

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry Wut. Mac in another state, but macOS genuinely supports caret browsing but hides the visual cue? Or is your statement hyperbole?

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian Seriously -- check this out: https://cdpn.io/pen/debug/NWVGBLG

You can make it visible with a custom caret indicator that's positioned by selectionchange. Place the cursor somewhere in the text, then you can navigate with arrows. Now try Shift + arrows, and it selects the text 😎

aardrian,
@aardrian@toot.cafe avatar

@siblingpastry That’s exactly the test I was going to try when I get home.

I look forward to updating my blog post about caret browsing.

siblingpastry,
@siblingpastry@mastodon.world avatar

@aardrian Just noting that it doesn't bring focus with it, you still have to Tab to those.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • javascript
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines