Skip to content

Skip on-click handling in contenteditable areas - #11

Open
bplubell wants to merge 1 commit into
clj-commons:masterfrom
bplubell:handle-contenteditable-links
Open

Skip on-click handling in contenteditable areas#11
bplubell wants to merge 1 commit into
clj-commons:masterfrom
bplubell:handle-contenteditable-links

Conversation

@bplubell

@bplubell bplubell commented Jan 16, 2026

Copy link
Copy Markdown

Default browser behavior is to NOT navigate to links that are marked as editable. Previously, links inside contenteditable areas that did not pass the conditions in the on-click handler (e.g. if they had a scheme and different origin) would behave as expected. However, links that did pass the conditions (e.g. if they were relative) would navigate, which does not match browser default behavior.

Notably, elements inside of a <div contenteditable="true"> may be override that, making them un-editable. When a link does that, the browser does navigate. This change will also navigate, mimicking browser behavior as expected.

Fixes #10

Default browser behavior is to NOT navigate to links that are marked as
editable. Previously, links inside contenteditable areas that did not
pass the conditions in the on-click handler (e.g. if they had a scheme
and different origin) would behave as expected. However, links that did
pass the conditions (e.g. if they were relative) would navigate, which
does not match browser default behavior.

Notably, elements inside of a <div contenteditable="true"> may be
override that, making them un-editable. When a link does that, the
browser *does* navigate. This change will also navigate, mimicking
browser behavior as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent navigating to links in contenteditable areas on click

1 participant