Skip to content

Conversation

NOMADE55
Copy link
Contributor

@NOMADE55 NOMADE55 commented Nov 12, 2024

What does this PR do?

When using the Select Component, the readonly input used to show the value is scrolled when this value is too long.
This PR leverages the input's scroll attribute to understand if the readonly input is being show properly.
Whenever scrollLeft is more than zero, we reset it back to beginning.

Where should the reviewer start?

What testing has been done on this PR?

  • Tried the fix in a test project.

How should this be manually tested?

  • Create a test case with a Select which value once displayed, is longer than the available space.

What are the relevant issues?

Do the grommet docs need to be updated?

  • No

Signed-off-by: Lucas Terracino <lukas.nomade@gmail.com>
@NOMADE55 NOMADE55 force-pushed the fix/scroll-input-with-long-value branch from 07f5fef to cd4e41c Compare November 12, 2024 05:23
Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jcfilben jcfilben requested a review from MikeKingdom November 15, 2024 03:38
Copy link
Collaborator

@MikeKingdom MikeKingdom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Tested with the original problem situation as well as typical readonly TextInputs.

I was a little worried it would prevent manual scrolling of long values but it did fine.

@jcfilben jcfilben merged commit bee2393 into grommet:master Nov 15, 2024
13 of 14 checks passed
@NOMADE55
Copy link
Contributor Author

Looks good. Tested with the original problem situation as well as typical readonly TextInputs.

I was a little worried it would prevent manual scrolling of long values but it did fine.

Great!
The only quirk is that it works on blur.
It's a good compromise. If the user is not focusing on the input anymore, resets its scroll.

@NOMADE55 NOMADE55 deleted the fix/scroll-input-with-long-value branch November 15, 2024 22:17
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.

Long option text sometimes gets rendered right-justified in Select
3 participants