ladybird/Libraries/LibWeb/HTML/Focus.h
Jelle Raaijmakers b07a576c22 LibWeb: Select contents of <input> when tabbing through fields
Browsers seem to make it convenient to replace an <input>'s contents by
selecting all text on focusing, but only if you used keyboard
navigation. Programmatic focus and clicking on the field do not show
this behavior.
2026-02-11 11:17:27 +01:00

24 lines
497 B
C++

/*
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
enum class FocusTrigger : u8 {
Click,
Key,
Script,
Other,
};
WEB_API void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target = nullptr, FocusTrigger focus_trigger = FocusTrigger::Other);
WEB_API void run_unfocusing_steps(DOM::Node* old_focus_target);
}