Open
Description
Following on from #5493, I think this also reveals another issue with the MaskedInput
:
Edit: Sorry just to clarify, this is relevant to initial focus or focus on tab. Clicking to focus the input seems to place the cursor without any text selection.
from textual.app import App, ComposeResult
from textual.widgets import Input, Label, MaskedInput
class InputSelectionApp(App):
CSS = """
Label {
margin: 1;
}
"""
def compose(self) -> ComposeResult:
yield Label("Input text is now selected on focus by default.")
yield Label(
"This is obvious to the user for the Input widget "
"where the selection is highlighted:"
)
yield Input("text")
yield Label(
"But not the MaskedInput, "
"which is confusing when typing will overwrite the previous text:"
)
yield MaskedInput(template="AAAAAAAA;-", value="text")
if __name__ == "__main__":
app = InputSelectionApp()
app.run()
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Jan 25, 2025
We found the following entry in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.
This is an automated reply, generated by FAQtory
fix(masked input): highlight selected text