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: adding overflow-wrap to dropdown #451 #482

Merged
merged 6 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions components/dropdown/metadata/dropdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ examples:
<h4>Open</h4>
<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">Ballard</span>
<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">Ballard</span>
<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">Fremont</span>
<span class="spectrum-Menu-itemLabel">Some 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">Greenwood</span>
<span class="spectrum-Menu-itemLabel">Very long text with 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>
Expand All @@ -62,7 +62,7 @@ examples:
<svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true" aria-label="Image">
<use xlink:href="#spectrum-icon-18-Image" />
</svg>
<span class="spectrum-Dropdown-label">Ballard</span>
<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>
Expand All @@ -73,7 +73,7 @@ examples:
<svg class="spectrum-Icon spectrum-Icon--sizeS spectrum-Menu-itemIcon" focusable="false" aria-hidden="true" aria-label="Image">
<use xlink:href="#spectrum-icon-18-Image" />
</svg>
<span class="spectrum-Menu-itemLabel">Ballard</span>
<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>
Expand All @@ -82,7 +82,7 @@ examples:
<svg class="spectrum-Icon spectrum-Icon--sizeS spectrum-Menu-itemIcon" focusable="false" aria-hidden="true" aria-label="Image">
<use xlink:href="#spectrum-icon-18-Image" />
</svg>
<span class="spectrum-Menu-itemLabel">Fremont</span>
<span class="spectrum-Menu-itemLabel">Some 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>
Expand All @@ -91,7 +91,7 @@ examples:
<svg class="spectrum-Icon spectrum-Icon--sizeS spectrum-Menu-itemIcon" focusable="false" aria-hidden="true" aria-label="Image">
<use xlink:href="#spectrum-icon-18-Image" />
</svg>
<span class="spectrum-Menu-itemLabel">Greenwood</span>
<span class="spectrum-Menu-itemLabel">Very long text with 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>
Expand Down
16 changes: 15 additions & 1 deletion components/menu/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,27 @@ governing permissions and limitations under the License.
.spectrum-Icon + .spectrum-Menu-itemLabel,
.spectrum-Menu-itemIcon + .spectrum-Menu-itemLabel {
margin-left: var(--spectrum-selectlist-thumbnail-image-padding-x);

width: calc(
100%
- var(--spectrum-icon-checkmark-medium-width)
- var(--spectrum-selectlist-option-icon-padding-x)
- var(--spectrum-selectlist-thumbnail-image-padding-x)
- var(--spectrum-alias-workflow-icon-size)
);
}
}

.spectrum-Menu-itemLabel {
flex: 1 1 auto;
line-height: var(--spectrum-selectlist-option-label-line-height);
word-break: break-all;
hyphens: auto;
overflow-wrap: break-word;
width: calc(
100%
- var(--spectrum-icon-checkmark-medium-width)
- var(--spectrum-selectlist-option-icon-padding-x)
);
}

.spectrum-Menu-itemLabel--wrapping {
Expand Down