Skip to content

No blinking cursor in editable elements #33237

Closed

Description

@webbeef

The lack of blinking cursor at the insertion point is making <input> and <textarea> hard to use :)

Activity

  1. added
    C-untriaged
    on Aug 28, 2024
  2. added
    A-layout/2020
    and removed
    C-untriaged
    on Aug 28, 2024
  3. mrobinson commented on Aug 28, 2024

    @mrobinson
    Member

    And currently right now there is no insertion cursor at all. 😅

  4. webbeef commented on Aug 28, 2024

    @webbeef
    ContributorAuthor

    well, using the arrow keys (at least on linux) moves the insertion point as expected, as well as the selection range when you hit [shift] with the arrows.

  5. jdm commented on Feb 12, 2025

    @jdm
    Member

    // Draw a caret at the insertion point.
    let insertion_point_index = match scanned_text_fragment_info.insertion_point {
    Some(insertion_point_index) => insertion_point_index,
    None => return,
    };
    let range = Range::new(
    scanned_text_fragment_info.range.begin(),
    insertion_point_index - scanned_text_fragment_info.range.begin(),
    );
    let advance = scanned_text_fragment_info.run.advance_for_range(&range);
    let insertion_point_bounds;
    let cursor;
    if !self.style.writing_mode.is_vertical() {
    insertion_point_bounds = rect(
    stacking_relative_border_box.origin.x + advance,
    stacking_relative_border_box.origin.y,
    INSERTION_POINT_LOGICAL_WIDTH,
    stacking_relative_border_box.size.height,
    );
    cursor = Cursor::Text;
    } else {
    insertion_point_bounds = rect(
    stacking_relative_border_box.origin.x,
    stacking_relative_border_box.origin.y + advance,
    stacking_relative_border_box.size.width,
    INSERTION_POINT_LOGICAL_WIDTH,
    );
    cursor = Cursor::VerticalText;
    };
    let base = state.create_base_display_item(
    insertion_point_bounds,
    self.node,
    self.unique_id(),
    get_cursor(&self.style, cursor),
    display_list_section,
    );
    state.add_display_item(DisplayItem::Rectangle(CommonDisplayItem::new(
    base,
    webrender_api::RectangleDisplayItem {
    common: items::empty_common_item_properties(),
    color: PropertyBinding::Value(self.style().get_inherited_text().color.to_layout()),
    bounds: insertion_point_bounds.to_layout(),
    },
    )));
    is the code in the old layout engine that implemented the cursor.

  6. JoshBashed commented on Feb 20, 2025

    @JoshBashed

    @servo-highfive assign me

  7. servo-highfive commented on Feb 20, 2025

    @servo-highfive

    Hey @JoshuaBrest! Thanks for your interest in working on this issue. It's now assigned to you!

  8. added
    C-assigned
    on Feb 20, 2025
  9. dklassic commented on Feb 24, 2025

    @dklassic
    Contributor

    Slightly related as I figure implementing caret should require this as well.

    @jdm may I ask how text layout was done currently? I'm trying to retrieve the bound of a given character inside a single Text element and I haven't found anything as of now. Similarly is it possible to retrieve the bound of a give character inside a single HTMLTextAreaElement or HTMLInputElement? If this doable I'm guessing text selection, caret rendering, and a more closely aligned IME cursor area should all be able to be implemented.

  10. JoshBashed commented on Feb 24, 2025

    @JoshBashed

    Slightly related as I figure implementing caret should require this as well.

    @jdm may I ask how text layout was done currently? I'm trying to retrieve the bound of a given character inside a single Text element and I haven't found anything as of now. Similarly is it possible to retrieve the bound of a give character inside a single HTMLTextAreaElement or HTMLInputElement? If this doable I'm guessing text selection, caret rendering, and a more closely aligned IME cursor area should all be able to be implemented.

    I’m working on this at the moment.

  11. dklassic commented on Feb 24, 2025

    @dklassic
    Contributor

    I’m working on this at the moment.

    I'm not looking into doing anything caret related, but if you have any insight I'm all ears.

  12. jdm commented on Feb 26, 2025

    @jdm
    Member

    Slightly related as I figure implementing caret should require this as well.

    @jdm may I ask how text layout was done currently? I'm trying to retrieve the bound of a given character inside a single Text element and I haven't found anything as of now. Similarly is it possible to retrieve the bound of a give character inside a single HTMLTextAreaElement or HTMLInputElement? If this doable I'm guessing text selection, caret rendering, and a more closely aligned IME cursor area should all be able to be implemented.

    I don't know the answer for the current layout engine. If we reused the IndexableText implementation for layout 2020 it would be easy to answer those questions.

  13. JoshBashed commented on Mar 4, 2025

    @JoshBashed

    @servo-highfive unassign me

  14. dklassic commented on Mar 6, 2025

    @dklassic
    Contributor

    @JoshuaBrest are you're still actively working on implementing caret? If not I think I have some time to implement it over the next few days.

  15. JoshBashed commented on Mar 6, 2025

    @JoshBashed
  16. self-assigned this
    on Mar 6, 2025
  17. added a commit that references this issue on Mar 12, 2026
    ea99515
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-inputA-layout/2020C-assigned

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions