mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Nested editing host focus should propagate to farthest ancestor
Nested editing hosts should act as a single big editing host, as long as there are no uneditable elements in between.
This commit is contained in:
parent
6c0a0b86ba
commit
90f1c8724b
Notes:
github-actions[bot]
2025-08-26 08:27:24 +00:00
Author: https://github.com/gmta
Commit: 90f1c8724b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5952
3 changed files with 20 additions and 0 deletions
|
|
@ -550,6 +550,8 @@ void Selection::set_range(GC::Ptr<DOM::Range> range)
|
|||
// AD-HOC: Focus editing host if the previous selection was outside of it. There seems to be no spec for this.
|
||||
if (range && range->start_container()->is_editable_or_editing_host()) {
|
||||
GC::Ref new_editing_host = *range->start_container()->editing_host();
|
||||
while (new_editing_host->parent() && new_editing_host->parent()->is_editing_host())
|
||||
new_editing_host = *new_editing_host->parent();
|
||||
if (document()->focused_element() != new_editing_host) {
|
||||
// FIXME: Determine and propagate the right focus trigger.
|
||||
HTML::run_focusing_steps(new_editing_host, nullptr, HTML::FocusTrigger::Other);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue