Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabled TextInput to still be interacted with #2262

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Koranir
Copy link
Contributor

@Koranir Koranir commented Feb 18, 2024

Resolves #1880

Follows Firefox's text selection usage (i.e. no blinking cursor, arrow keys don't do anything unless shift is pressed, cursor click position is remembered).

Draft for the following reasons:

  • Should the placeholder text be selectable?
  • Should this apply to TextEditors as well?
  • Currently, the allowed operations when disabled are copy and select all in addition to the selection primitives. Should there be more?

@habics
Copy link

habics commented Feb 27, 2024

  • Should this apply to TextEditors as well?

Yes please, imo TextEditor is a TextInput on steroids, it should have all the behavior of TextInput plus more features.
There are many befits to have this behavior for TextEditor as well, for example using it to display long informational text that can be copied without editing it.

@Koranir
Copy link
Contributor Author

Koranir commented Feb 29, 2024

  • Should this apply to TextEditors as well?

Yes please, imo TextEditor is a TextInput on steroids, it should have all the behavior of TextInput plus more features. There are many befits to have this behavior for TextEditor as well, for example using it to display long informational text that can be copied without editing it.

Now that I've taken a closer look at the TextEditor architecture, it seems impossible to add this, as the TextEditor's state is held by the user. This means that the user has to provide a way to manipulate the state via the set_action method, but that would enable the text input instead.

(Actually, it seems like the end user can just discard actions by the TextEditor that would modify the file contents, so it would pretty much be the same as a normal display.)

What would be more appropriate would be to have a separate TextDisplay or similar widget that provides copy/paste capabilities and maybe some additional customisation options.

@Koranir Koranir marked this pull request as ready for review February 29, 2024 00:46
@habics
Copy link

habics commented Feb 29, 2024

@Koranir
I understand, thank you for taking a closer look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled TextInput should still allow mouse interaction, selection and copying
2 participants