Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/setup-node…
Browse files Browse the repository at this point in the history
…-4.0.2
  • Loading branch information
tay1orjones authored Feb 13, 2024
2 parents 73662fc + ffc385b commit f2eb208
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 64 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,15 @@
"contributions": [
"code"
]
},
{
"login": "ggdawson",
"name": "Garrett Dawson",
"avatar_url": "https://avatars.githubusercontent.com/u/37080130?v=4",
"profile": "https://github.com/ggdawson",
"contributions": [
"code"
]
}
],
"commitConvention": "none"
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
<td align="center"><a href="https://github.com/amercury"><img src="https://avatars.githubusercontent.com/u/17834588?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexandr Ovchinnikov</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=amercury" title="Code">💻</a></td>
<td align="center"><a href="https://jt-helsinki.github.io/blog/"><img src="https://avatars.githubusercontent.com/u/20871336?v=4?s=100" width="100px;" alt=""/><br /><sub><b>J Thomas</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=jt-helsinki" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/ggdawson"><img src="https://avatars.githubusercontent.com/u/37080130?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Garrett Dawson</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=ggdawson" title="Code">💻</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
Expand Down
19 changes: 7 additions & 12 deletions packages/react/src/components/ComposedModal/ComposedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,13 @@ export const ModalBody = React.forwardRef<HTMLDivElement, ModalBodyProps>(
: {};

return (
<>
<div
className={contentClass}
{...hasScrollingContentProps}
{...rest}
ref={ref}>
{children}
</div>
{hasScrollingContent && (
<div className={`${prefix}--modal-content--overflow-indicator`} />
)}
</>
<div
className={contentClass}
{...hasScrollingContentProps}
{...rest}
ref={ref}>
{children}
</div>
);
}
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface DataTableRow<ColTypes extends any[]> {
export interface DataTableHeader {
key: string;
header: React.ReactNode;
slug: React.ReactElement;
slug?: React.ReactElement;
}

export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
Expand Down
3 changes: 0 additions & 3 deletions packages/react/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,6 @@ const Modal = React.forwardRef(function Modal(
{...hasScrollingContentProps}>
{children}
</div>
{hasScrollingContent && (
<div className={`${prefix}--modal-content--overflow-indicator`} />
)}
{!passiveModal && (
<ButtonSet className={footerClasses} aria-busy={loadingActive}>
{Array.isArray(secondaryButtons) && secondaryButtons.length <= 2
Expand Down
15 changes: 15 additions & 0 deletions packages/react/src/components/MultiSelect/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export interface MultiSelectProps<ItemType>
> {
className?: string;

/**
* Specify the text that should be read for screen readers that describes that all items are deleted
*/
clearAnnouncement?: string;

/**
* Specify the text that should be read for screen readers that describes total items selected
*/
Expand Down Expand Up @@ -324,6 +329,7 @@ const MultiSelect = React.forwardRef(
sortItems = defaultSortItems as MultiSelectProps<ItemType>['sortItems'],
compareItems = defaultCompareItems,
clearSelectionText = 'To clear selection, press Delete or Backspace',
clearAnnouncement = 'all items have been cleared',
clearSelectionDescription = 'Total items selected: ',
light,
invalid,
Expand Down Expand Up @@ -353,6 +359,7 @@ const MultiSelect = React.forwardRef(
const [isOpen, setIsOpen] = useState(open || false);
const [prevOpenProp, setPrevOpenProp] = useState(open);
const [topItems, setTopItems] = useState([]);
const [itemsCleared, setItemsCleared] = useState(false);
const {
selectedItems: controlledSelectedItems,
onItemChange,
Expand Down Expand Up @@ -409,12 +416,17 @@ const MultiSelect = React.forwardRef(
e.stopPropagation();
}

if (!isOpen && match(e, keys.Delete) && selectedItems.length > 0) {
setItemsCleared(true);
}

if (
(match(e, keys.Space) ||
match(e, keys.ArrowDown) ||
match(e, keys.Enter)) &&
!isOpen
) {
setItemsCleared(false);
setIsOpenWrapper(true);
}
}
Expand Down Expand Up @@ -709,6 +721,9 @@ const MultiSelect = React.forwardRef(
}
)}
</ListBox.Menu>
{itemsCleared && (
<span aria-live="assertive" aria-label={clearAnnouncement} />
)}
</ListBox>
{!inline && !invalid && !warn && helperText && (
<div id={helperId} className={helperClasses}>
Expand Down
58 changes: 10 additions & 48 deletions packages/styles/scss/components/modal/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -350,60 +350,22 @@
.#{$prefix}--modal-scroll-content {
// Required to accommodate focus outline's negative offset when scrolling in Chrome
border-block-end: 2px solid transparent;
mask-image: linear-gradient(
to bottom,
$layer calc(100% - 80px),
transparent calc(100% - 48px),
transparent 100%
),
linear-gradient(to left, $layer 0, 16px, transparent 16px),
linear-gradient(to right, $layer 0, 2px, transparent 2px),
linear-gradient(to top, $layer 0, 2px, transparent 2px);
}

// Required so overflow-indicator disappears at end of content
.#{$prefix}--modal-scroll-content > *:last-child {
padding-block-end: $spacing-06;
}

.#{$prefix}--modal-content--overflow-indicator {
position: absolute;
background: $layer;
block-size: convert.to-rem(48px);
grid-column: 1/-1;
grid-row: 2/-2;
inline-size: calc(100% - $spacing-05);
inset-block-end: 0;
inset-inline-start: 0;
pointer-events: none;

&::before {
position: absolute;
background-image: linear-gradient(to bottom, transparent, $layer);
block-size: convert.to-rem(32px);
content: '';
inline-size: 100%;
inset-block-start: -32px;
pointer-events: none;
}
}

// Safari-only media query
// won't appear correctly with CSS custom properties
// see: code snippet and tabs overflow indicators
@media not all and (min-resolution >= 0.001dpcm) {
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
.#{$prefix}--modal-content--overflow-indicator {
background-image: linear-gradient(to bottom, rgba($layer, 0), $layer);
}
}
}

.#{$prefix}--modal-content:focus
~ .#{$prefix}--modal-content--overflow-indicator {
margin: 0 2px 2px;
}

@media screen and (-ms-high-contrast: active) {
.#{$prefix}--modal-scroll-content > *:last-child {
padding-block-end: 0;
}

.#{$prefix}--modal-content--overflow-indicator {
display: none;
}
}

// -----------------------------
// Modal footer
// -----------------------------
Expand Down

0 comments on commit f2eb208

Please sign in to comment.