-
Notifications
You must be signed in to change notification settings - Fork 195
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: adding overflow-wrap to dropdown #451 #482
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment about width.
Also, can we test in IE 11 please?
components/menu/index.css
Outdated
word-break: break-all; | ||
hyphens: auto; | ||
overflow-wrap: break-word; | ||
width: 80%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
80% is a bit arbitrary. Should this be calc(100% - whatever space we need for an icon)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calc
should be a good solution. I don't have IE 11 set up on my main machine. What solution are you using now for testing ie11? bootcamp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Windows 8 instance is not supported anymore, it is recommended to use the Windows 10 instance that also has IE11 and MS Edge.
You can use VMWare fusion V11. (full setup here including serial number https://adobe.service-now.com/sc?id=kb_article&sys_id=1f47158d1bfd00d04bd1620f6e4bcbc4) or via SMB: smb://sjstore.corp.adobe.com/Labs/VMware/Fusion
You can download the latest supported Windows 10 here or ping me and I can send you the the fully configured VMWare fusion disk image (https://labvmlibrary.corp.adobe.com seems to be unresponsive at this time)
About using calc: It's only partially supported in IE11 (https://caniuse.com/#feat=calc) and will look like this in this scenario after gulp build
(please ignore the background color, it's only demonstrating the width).
using width: calc(100% - (var(--spectrum-icon-checkmark-medium-width) + var(--spectrum-selectlist-option-icon-padding-x)));
seems to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bernhard-adobe I'm aware that calc
is partially supported in IE 11, and looking again at the known issues, none of them are relevant to our use case. Why did you bring it up? Is there something I missed? From your screenshot, it looks totally correct in IE11, right?
I'm not worried about the unsupported VM, it works perfectly fine, but thanks for the info!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using
width: calc(100% - (var(--spectrum-icon-checkmark-medium-width) + var(--spectrum-selectlist-option-icon-padding-x)));
seems to work.
I mentioned earlier in my comment that I agreed to this testing of calc and it seems to work here.
Some known issues with calc in IE11 that could cause potential rendering issues (under "bugs" https://docs.w3cub.com/browser_support_tables/calc/):
- unknown total width of the entire context menu, aka width is not set
- auto-generated content gets set wrong width
@bernhard-adobe I went to test this in IE 11, but it seems your test strings from the screenshot are not present. Can you make another example or modify the current example so we can test this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lazd here is the HTML you can add the dropdown.yml.
I am not sure if we should add those corner cases to our components as it's kind of confusing to suddenly have different languages appear.
<div class="spectrum-Dropdown is-open" style="width: 240px;">
<button class="spectrum-FieldButton spectrum-Dropdown-trigger is-selected" aria-haspopup="listbox">
<span class="spectrum-Dropdown-label">Donaudampfschifffahrtsgesellschaftskapitän</span>
<svg class="spectrum-Icon spectrum-UIIcon-ChevronDownMedium spectrum-Dropdown-icon" focusable="false" aria-hidden="true">
<use xlink:href="#spectrum-css-icon-ChevronDownMedium" />
</svg>
</button>
<div class="spectrum-Popover spectrum-Popover--bottom spectrum-Dropdown-popover is-open" style="width: 100%">
<ul class="spectrum-Menu" role="listbox">
<li class="spectrum-Menu-item is-selected" role="option" aria-selected="true" tabindex="0">
<span class="spectrum-Menu-itemLabel">Donaudampfschifffahrtsgesellschaftskapitän</span>
<svg class="spectrum-Icon spectrum-UIIcon-CheckmarkMedium spectrum-Menu-checkmark spectrum-Menu-itemIcon" focusable="false" aria-hidden="true">
<use xlink:href="#spectrum-css-icon-CheckmarkMedium" />
</svg>
</li>
<li class="spectrum-Menu-item" role="option" tabindex="0">
<span class="spectrum-Menu-itemLabel">Some crazy long value that should be cut off</span>
<svg class="spectrum-Icon spectrum-UIIcon-CheckmarkMedium spectrum-Menu-checkmark spectrum-Menu-itemIcon" focusable="false" aria-hidden="true">
<use xlink:href="#spectrum-css-icon-CheckmarkMedium" />
</svg>
</li>
<li class="spectrum-Menu-item" role="option" tabindex="0">
<span class="spectrum-Menu-itemLabel">A very long text that has spaces and hyphens-between-words.</span>
<svg class="spectrum-Icon spectrum-UIIcon-CheckmarkMedium spectrum-Menu-checkmark spectrum-Menu-itemIcon" focusable="false" aria-hidden="true">
<use xlink:href="#spectrum-css-icon-CheckmarkMedium" />
</svg>
</li>
<li class="spectrum-Menu-divider" role="separator"></li>
<li class="spectrum-Menu-item is-disabled" role="option" aria-disabled="true">
<span class="spectrum-Menu-itemLabel">United States of America</span>
<svg class="spectrum-Icon spectrum-UIIcon-CheckmarkMedium spectrum-Menu-checkmark spectrum-Menu-itemIcon" focusable="false" aria-hidden="true">
<use xlink:href="#spectrum-css-icon-CheckmarkMedium" />
</svg>
</li>
</ul>
</div>
</div>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calc
change looks good, but we need an example.
What I was saying is that we absolutely SHOULD add those examples for corner cases. It doesn't matter if it's confusing, these are our tests. If something breaks in the future with respect to word wrapping in dropdowns, we won't know unless we add those examples. Please add the example.
added examples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bernhard-adobe the issue I sent the screenshot of only happens when there is an icon, and I took it in Chrome. I have a fix for it, I can push it. |
Adding overflow-wrap and hyphen option to dropdown label and limiting the width to
80%
to force wrapping.Description
In order to break "unbreakable words" like German connected nouns or urls / paths we need to allow overflow-wrap for words.
Fixes #451 (SDS-4649).
Previous fix was not sufficient int #452
How and where has this been tested?
Swap out the following text in the
components/dropdown/metadata/dropdown.yml
go to
http://localhost:3000/docs/dropdown.html
and inspect the dropdown labelBrowsers left to right:
On macOs Mojave 10.14.5 (18F203):
Chrome Version 81.0.4027.0 (Official Build) canary (64-bit)
Safari Version 12.1.1 (14607.2.6.1.1)
FireFox 72.0.1 (64-bit)
Edge Version 80.0.361.32 (Official build) Beta (64-bit)
On Windows 10:
Microsoft Edge 42.17134.1098.0
Screenshots
To-do list