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

fix: Adjusting the width of dropdown #18059

Merged
merged 3 commits into from
May 14, 2020
Merged

fix: Adjusting the width of dropdown #18059

merged 3 commits into from
May 14, 2020

Conversation

zoesteinkamp
Copy link
Contributor

@zoesteinkamp zoesteinkamp commented May 12, 2020

This will make it so the width of the dropdown will adjust to the longest variable name

Closes #18021

Describe your proposed changes here.
Ive done a simple math problem that determines the longest length in the values and makes that the width px
Screen Shot 2020-05-12 at 12 04 44 PM

  • CHANGELOG.md updated with a link to the PR (not the Issue)
  • Well-formatted commit messages
  • Rebased/mergeable
  • Tests pass
  • http/swagger.yml updated (if modified Go structs or API)
  • Documentation updated or issue created (provide link to issue/pr)
  • Signed CLA (if not already signed)

@zoesteinkamp zoesteinkamp requested a review from drdelambre May 12, 2020 18:57
140,
values.reduce(function(a, b) {
return a.length > b.length ? a : b
}, '').length * 8
Copy link
Contributor

Choose a reason for hiding this comment

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

how did you choose the number eight?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not going to lie, it looked the best in the UI. I tried a few numbers, and 8 looked ideal for the px

Copy link
Contributor

Choose a reason for hiding this comment

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

is the intent to find out what the max width of the longest variable could be?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the intent is find the longest variable, then take its length and determine how much width in px would be needed to display it

@drdelambre drdelambre requested a review from alexpaxton May 12, 2020 19:23
@drdelambre
Copy link
Contributor

@alexpaxton do you have any fancy tricks for measuring text up your sleeve? i have a fear that we're tightly coupling a font choice to system behavior here

@alexpaxton
Copy link
Contributor

If we style the dropdown items to be in the monospace font then all characters will be the same width, and more predictable

@zoesteinkamp zoesteinkamp requested a review from drdelambre May 13, 2020 22:05
Copy link
Contributor

@drdelambre drdelambre left a comment

Choose a reason for hiding this comment

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

usually when there's measuring of text to be done, you send the text to a hidden span floating off screen and measure the span, and that decouples font size / face / letterspacing issues from the measurement, but i can't see a favorable ROI on using that technique unless it's done in clockface for all the things

This will make it so the width of the dropdown will adjust to the longest variable name
@zoesteinkamp zoesteinkamp merged commit 17f4cc1 into master May 14, 2020
@drdelambre drdelambre deleted the variablestruncated branch May 14, 2020 21:53
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.

Dashboards: Variable values are truncated
3 participants