Phenomenon
When a link already exists in contenteditable, updating the href attribute is difficult. There’s no native way to edit the URL, and programmatic updates may not be reflected in the DOM immediately.
Reproduction example
- Create a link:
<a href="url1">Link text</a> - Try to update the href to a different URL
- Observe the DOM
Observed behavior
- No native way to edit href
- Programmatic updates may not work
- Or updates may not be reflected
- Difficult to modify existing links
Expected behavior
- Should be able to edit link URL easily
- Or programmatic updates should work reliably
- Changes should be reflected immediately
- Link editing should be intuitive
Browser Comparison
- All browsers: No native href editing
- Custom implementation needed for link editing
Notes and possible direction for workarounds
- Provide UI for editing link href
- Intercept link clicks to show edit dialog
- Update href programmatically
- Ensure changes are reflected in DOM