LibWeb: Don't place cursor on certain <input> elements

For example, button inputs shouldn't have a cursor
displayed in their text since they're not editable,
and are not meant to be editable.

Fixes #4140

Co-authored-by: Sam Atkins <sam@ladybird.org>
This commit is contained in:
Saksham Mittal 2025-05-16 09:22:38 +05:30 committed by Sam Atkins
parent 17f14a277b
commit c52c05555b
Notes: github-actions[bot] 2025-06-02 10:39:46 +00:00
3 changed files with 16 additions and 3 deletions

View file

@ -1594,6 +1594,14 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_type(String const& type)
return set_attribute(HTML::AttributeNames::type, type);
}
bool HTMLInputElement::can_have_text_editing_cursor() const
{
if (first_is_one_of(type_state(), TypeAttributeState::SubmitButton, TypeAttributeState::ResetButton, TypeAttributeState::Button))
return false;
return true;
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-simple-colour
static bool is_valid_simple_color(StringView value)
{