mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
LibWeb: Do not delete empty range in EventHandler::handle_keydown()
Fixes a crash that occurs when inputting into an empty contenteditable element (`EditEventHandler::handle_delete()` assumes the cursor position's node is always `DOM::Text`, which is not the case for an empty `contenteditable`).
This commit is contained in:
parent
1528e9109c
commit
6b17ab77f3
1 changed files with 1 additions and 1 deletions
|
@ -757,7 +757,7 @@ bool EventHandler::handle_keydown(KeyCode key, u32 modifiers, u32 code_point)
|
|||
|
||||
if (auto selection = document->get_selection()) {
|
||||
auto range = selection->range();
|
||||
if (range && range->start_container()->is_editable()) {
|
||||
if (range && !range->collapsed() && range->start_container()->is_editable()) {
|
||||
selection->remove_all_ranges();
|
||||
|
||||
// FIXME: This doesn't work for some reason?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue