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

Buttons with long text should cut them off #5660

Closed
yannikmesserli opened this issue Oct 28, 2022 · 12 comments
Closed

Buttons with long text should cut them off #5660

yannikmesserli opened this issue Oct 28, 2022 · 12 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Scene Viewer Issues logged by ArcGIS Scene Viewer team members enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. i18n-l10n issues dealing with internationalization/localization p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@yannikmesserli
Copy link

Actual Behavior

When an unbreakable text is set to a button which is longer that what the button's width is capable of handling, the text overflow and break the button's layout.

Expected Behavior

The text should be cut-off.

Reproduction Sample

https://codepen.io/yannikm/pen/xxzGPRE?editors=100

Reproduction Steps

Check the codepen's sample above.

Reproduction Version

beta.97

Relevant Info

No response

Regression?

No response

Esri team

ArcGIS Scene Viewer

@yannikmesserli yannikmesserli added 0 - new New issues that need assignment. bug Bug reports for broken functionality. Issues should include a reproduction of the bug. needs triage Planning workflow - pending design/dev review. labels Oct 28, 2022
@alisonailea alisonailea added the design Issues that need design consultation prior to development. label Nov 1, 2022
@alisonailea
Copy link
Contributor

alisonailea commented Nov 1, 2022

We have had some conflicting requests for the right resolution to text overflows in components. We may need to provide an optional prop or find another solution per designer's recommendations. @SkyeSeitz @ashetland

@SkyeSeitz
Copy link

Thanks, @alisonailea. Let's connect on all the text overflow requests as a collection.

@yannikmesserli do either of these examples below demonstrate the expected behavior you are describing?

image

@ashetland
Copy link
Contributor

The truncated version feels like the best failure state in the case. @alisonailea, we should sync up on other components where this occurs. Hopefully a similar strategy will work kit-wide. 🤞

@jcfranco
Copy link
Member

jcfranco commented Nov 1, 2022

Hopefully, we can arrive at a single way of handling this to avoid props if possible. Some additional things to consider:

  1. slotted content – depending on the slotted HTML, it won't be possible for us to handle truncation via CSS
  2. translations/overrides (near future) – different languages may have strings that impact the original component layout, these can also be overridden by users, which seems closer to this issue
  3. a11y – we should be fine here as long as truncation is handled at a visual level and not by manipulating text content

cc @geospatialem @annierm18

@yannikmesserli
Copy link
Author

The truncated version feels like the best failure state in the case. @alisonailea, we should sync up on other components where this occurs. Hopefully a similar strategy will work kit-wide. 🤞

Agreed 🪁

We may need to provide an optional prop or find another solution per designer's recommendations.

It probably makes sense to have an optional prop (truncated?). There are probably good uses cases that embed html element that needs to be on the edge, e.g. thumbs, so truncated inline element will break their design.

@benelan benelan added the ArcGIS Scene Viewer Issues logged by ArcGIS Scene Viewer team members label Nov 15, 2022
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Feb 16, 2023
@geospatialem geospatialem removed the needs triage Planning workflow - pending design/dev review. label Feb 16, 2023
@geospatialem geospatialem added 0 - new New issues that need assignment. and removed design Issues that need design consultation prior to development. 1 - assigned Issues that are assigned to a sprint and a team member. labels Mar 20, 2023
@geospatialem geospatialem added enhancement Issues tied to a new feature or request. and removed bug Bug reports for broken functionality. Issues should include a reproduction of the bug. labels Mar 20, 2023
@brittneytewks brittneytewks added p - medium Issue is non core or affecting less that 60% of people using the library estimate - 3 A day or two of work, likely requires updates to tests. labels Mar 21, 2023
@geospatialem
Copy link
Member

cc fix from #5683 (comment)

@jcfranco
Copy link
Member

@ashetland @SkyeSeitz #5683 (comment) addressed this problem in a separate component and its wrapping vs what's proposed above. Should this adopt the same approach? If not, can you chime in on guidelines for dealing with long text?

@SkyeSeitz
Copy link

@ashetland @SkyeSeitz #5683 (comment) addressed this problem in a separate component and its wrapping vs what's proposed above. Should this adopt the same approach? If not, can you chime in on guidelines for dealing with long text?

Thanks, Franco. The guideline here would be to truncate long text on fixed width components that should not grow in height, such as the Button discussed above. This is to avoid oversized buttons and/or misalignment as seen below:
image
Instead, visually truncated text is the preferred failure state.

For components that are meant to grow in height, such as Accordion, the guideline would be to wrap text as seen #5683.

@Elijbet Elijbet self-assigned this Mar 26, 2023
@Elijbet Elijbet added 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. labels Mar 26, 2023
@ashetland
Copy link
Contributor

Summary of discussion about the best way to display the full text:

Preference is for truncated buttons to use html label to display the full text. This would leave calcite-tooltip available for additional context and configurations.

@Elijbet
Copy link
Contributor

Elijbet commented Apr 7, 2023

Summary of discussion about the best way to display the full text:

Preference is for truncated buttons to use html label to display the full text. This would leave calcite-tooltip available for additional context and configurations.

This comment in a related issue has some details of the implementation #5903 (comment) The image attached here shows how the tooltip and html label would work together in terms of layout, and how the button with those would work in slotted contexts.

Elijbet added a commit that referenced this issue Apr 14, 2023
**Related Issue:** #5660

## Summary

Truncate long text on fixed-width components that should not grow in
height.

To avoid unnecessary noise, detect the `buttons` with text that has been
truncated and apply `title attribute` conditionally only to these, to
reveal the full text for sighted users. This frees up the
`calcite-tooltip` to provide additional context.

Added an e2e test to ensure the long text is truncated and the `title
attribute` is added when it is.
@Elijbet Elijbet added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Apr 14, 2023
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Apr 14, 2023
@geospatialem
Copy link
Member

Verified in 1.3.0-next.6.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. ArcGIS Scene Viewer Issues logged by ArcGIS Scene Viewer team members enhancement Issues tied to a new feature or request. estimate - 3 A day or two of work, likely requires updates to tests. i18n-l10n issues dealing with internationalization/localization p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

10 participants