Skip to content

Commit 355a64d

Browse files
authored
fix(header): adjust edge-aligned popover positioning (#20322)
1 parent 88637fd commit 355a64d

File tree

2 files changed

+22
-64
lines changed

2 files changed

+22
-64
lines changed

packages/react/src/components/Popover/Popover.stories.js

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -373,68 +373,6 @@ export const ExperimentalAutoAlignBoundary = () => {
373373
);
374374
};
375375

376-
export const Test = () => {
377-
const [open, setOpen] = useState();
378-
const align = document?.dir === 'rtl' ? 'bottom-right' : 'bottom-left';
379-
const alignTwo = document?.dir === 'rtl' ? 'bottom-left' : 'bottom-right';
380-
return (
381-
<div style={{ display: 'flex', gap: '8rem' }}>
382-
<OverflowMenu
383-
flipped={document?.dir === 'rtl'}
384-
aria-label="overflow-menu">
385-
<OverflowMenuItem itemText="Stop app" />
386-
<OverflowMenuItem itemText="Restart app" />
387-
<OverflowMenuItem itemText="Rename app" />
388-
<OverflowMenuItem itemText="Clone and move app" disabled requireTitle />
389-
<OverflowMenuItem itemText="Edit routes and access" requireTitle />
390-
<OverflowMenuItem hasDivider isDelete itemText="Delete app" />
391-
</OverflowMenu>
392-
393-
<Popover
394-
align={align}
395-
open={open}
396-
onKeyDown={(evt) => {
397-
if (match(evt, keys.Escape)) {
398-
setOpen(false);
399-
}
400-
}}
401-
isTabTip
402-
onRequestClose={() => setOpen(false)}>
403-
<button
404-
aria-label="Settings"
405-
type="button"
406-
aria-expanded={open}
407-
onClick={() => {
408-
setOpen(!open);
409-
}}>
410-
<Settings />
411-
</button>
412-
<PopoverContent className="p-3">
413-
<RadioButtonGroup
414-
style={{ alignItems: 'flex-start', flexDirection: 'column' }}
415-
legendText="Row height"
416-
name="radio-button-group"
417-
defaultSelected="small">
418-
<RadioButton labelText="Small" value="small" id="radio-small" />
419-
<RadioButton labelText="Large" value="large" id="radio-large" />
420-
</RadioButtonGroup>
421-
<hr />
422-
<fieldset className={`cds--fieldset`}>
423-
<legend className={`cds--label`}>Edit columns</legend>
424-
<Checkbox defaultChecked labelText="Name" id="checkbox-label-1" />
425-
<Checkbox defaultChecked labelText="Type" id="checkbox-label-2" />
426-
<Checkbox
427-
defaultChecked
428-
labelText="Location"
429-
id="checkbox-label-3"
430-
/>
431-
</fieldset>
432-
</PopoverContent>
433-
</Popover>
434-
</div>
435-
);
436-
};
437-
438376
export const TabTipExperimentalAutoAlign = () => {
439377
const [open, setOpen] = useState(true);
440378
const ref = useRef();

packages/styles/scss/components/ui-shell/header/_header.scss

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright IBM Corp. 2016, 2023
2+
// Copyright IBM Corp. 2016, 2025
33
//
44
// This source code is licensed under the Apache-2.0 license found in the
55
// LICENSE file in the root directory of this source tree.
@@ -57,6 +57,26 @@
5757
z-index: z('header') + 1;
5858
}
5959

60+
.#{$prefix}--header {
61+
.#{$prefix}--popover--bottom-start:not(.#{$prefix}--popover--auto-align) {
62+
> .#{$prefix}--popover {
63+
> .#{$prefix}--popover-caret,
64+
> .#{$prefix}--popover-content {
65+
inset-inline-start: $spacing-05;
66+
}
67+
}
68+
}
69+
70+
.#{$prefix}--popover--bottom-end:not(.#{$prefix}--popover--auto-align) {
71+
> .#{$prefix}--popover {
72+
> .#{$prefix}--popover-caret,
73+
> .#{$prefix}--popover-content {
74+
inset-inline-end: $spacing-05;
75+
}
76+
}
77+
}
78+
}
79+
6080
.#{$prefix}--header__action > :first-child {
6181
margin-block-start: 0;
6282
}

0 commit comments

Comments
 (0)