Skip to content

Potential bug with Label containing input on dblclick to select all text. #1323

@reinhard-sanz

Description

@reinhard-sanz

Describe the bug

When using the bits UI Label component like this:

<Label.Root id="test-labek" for="test">
	"My Bits Input"
	<input type="text" id="test">
</Label.Root>

It effectively blocks me from double-clicking the input content to select the whole text in the input.

The reason for this is found here

if (e.detail > 1) e.preventDefault();

The e.detail > 1 followed by the preventDefault() blocks the doublclick on the text within the Input.

What is the reason behind that preventDefault(), and is it really needed? Does it make sense to allow for disabling this behaviour? :)

Sorry for no reproduction, the state of https://bits-ui.com/repro is ancient and for some reason the Svelte Repl won't load bits ui. :/
I'll add the reproduction oncei get something to run.

Reproduction

WIP

Logs

System Info

Svelte 5.25.3
Bits-UI 1.3.13

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageA maintainer needs to review this issue and label it appropriately

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions