-
Notifications
You must be signed in to change notification settings - Fork 77
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
Bug: calcite-combobox: long strings arent formatted correctly #2096
Comments
@julio8a who would this be for? |
Does this look like this might be part of refactoring? @caripizza If it is, we should add it to that refactor epic. |
I think we should elevate this, mapviewer can't use this for layer selector until this is fixed. @julio8a @jcfranco @caripizza |
@driskull @kevindoshier It's not quite clear to me from the screenshot, but does this codepen represent the issue? https://codepen.io/jcfranco/pen/YzZOXNp?editors=1000 |
@jcfranco yes but also when the selection mode is single |
Got it. Thanks for the info. Adding it to this sprint as |
I think a designer needs to take this issue since it's mostly a design decision on what to do and then updating the SCSS. |
@kevindoshier @driskull Can you please add the code snippet that shows the issue? I'm having trouble replicating |
Doesnt this one reproduce it? |
Thanks @kevindoshier, I missed that comment. Can you add repro steps to the Description to help make it more clear? Or is this just a question of what it should look like when it's refactored to wrap? |
Its just about needing it to be styled correctly |
@driskull - I chatted with @bstifle about this just now. What if we just truncate the selected item's text label with ellipses ("...") if it's over 25 characters long? private trimLabels = (textLabel, chars = 25) => {
return textLabel.length > chars ? textLabel.substring(0, chars) + "..." : textLabel;
}; Here's what that looks like on master without any extra styles: The list item would still show the full label text like so: Here's the markup I used for these screenshots: <div style="width:350px;margin-left:1rem;">
<h3>Multi</h3>
<calcite-combobox
label="demo combobox 1"
selection-mode="multi"
allow-custom-values
>
<calcite-combobox-item value="Trees" text-label="Trees">
<calcite-combobox-item
value="CommercialDamageAssessment - Damage to Commercial Buildings & Damage to Commercial Buildings"
text-label="CommercialDamageAssessment - Damage to Commercial Buildings & Damage to Commercial Buildings"
selected
></calcite-combobox-item>
<calcite-combobox-item
value="Sequoia"
disabled
text-label="Sequoia"
></calcite-combobox-item>
<calcite-combobox-item
value="Douglas Fir"
text-label="Douglas Fir"
></calcite-combobox-item>
</calcite-combobox-item>
</calcite-combobox>
</div>
<div style="width:350px;margin-left:1rem;">
<h3>Ancestors</h3>
<calcite-combobox
label="demo combobox 2"
selection-mode="ancestors"
allow-custom-values
>
<calcite-combobox-item value="Trees" text-label="Trees">
<calcite-combobox-item
value="CommercialDamageAssessment - Damage to Commercial Buildings & Damage to Commercial Buildings"
text-label="CommercialDamageAssessment - Damage to Commercial Buildings & Damage to Commercial Buildings"
selected
></calcite-combobox-item>
<calcite-combobox-item
value="Sequoia"
disabled
text-label="Sequoia"
></calcite-combobox-item>
<calcite-combobox-item
value="Douglas Fir"
text-label="Douglas Fir"
></calcite-combobox-item>
</calcite-combobox-item>
</calcite-combobox>
</div>
<div style="width:350px;margin-left:1rem;">
<h3>Single</h3>
<calcite-combobox
label="demo combobox 3"
selection-mode="single"
allow-custom-values
>
<calcite-combobox-item value="Trees" text-label="Trees">
<calcite-combobox-item
value="CommercialDamageAssessment - Damage to Commercial Buildings"
text-label="CommercialDamageAssessment - Damage to Commercial Buildings"
selected
></calcite-combobox-item>
<calcite-combobox-item
value="Sequoia"
disabled
text-label="Sequoia"
></calcite-combobox-item>
<calcite-combobox-item
value="Douglas Fir"
text-label="Douglas Fir"
></calcite-combobox-item>
</calcite-combobox-item>
<calcite-combobox-item
value="Rivers"
text-label="Rivers"
></calcite-combobox-item>
</calcite-combobox>
</div> |
That sounds reasonable to me. |
Maybe make this a domUtil as well?
|
@caripizza actually, can we just use CSS to do this? Seems like we can just use the |
@driskull I think with just CSS, we'd have to make sure the chip's close button stays visible too. I prefer the domUtil approach, since many components could opt into this trim pattern. |
I think we can do that with css still. The text already has a container inside the chip. |
@driskull can I assign this to you then? It sounds like you got it working |
Sure, ill take a stab at it |
* fix(combobox): Truncate long strings correctly. #2096 * review fix * revert title * label de chip.
Installed. |
Verified on master. |
Actual Behavior
calcite-combobox: long strings arent formatted correctly
Expected Behavior
Shouldnt mess up the formatting of the combobox
Reproduction Steps or Sample
Relevant Info
Version:
@esri/calcite-components@<version>
The text was updated successfully, but these errors were encountered: