Skip to content

Commit

Permalink
fix(rich-text): prevent layout shift in the toolbar after changing th…
Browse files Browse the repository at this point in the history
…e headline
  • Loading branch information
chrishelgert committed Jan 23, 2024
1 parent 60be551 commit a46a030
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import { Element } from '../../../internal/types';
import { useSdkContext } from '../../../SdkProvider';

const styles = {
// prevent the layout to jump due switch from "normal text" to "headline" and vice versa
button: css({
minWidth: '125px',
justifyContent: 'space-between',
}),
dropdown: {
root: css`
font-weight: ${tokens.fontWeightDemiBold};
Expand Down Expand Up @@ -137,12 +142,12 @@ export function ToolbarHeadingButton(props: ToolbarHeadingButtonProps) {
endIcon={<ChevronDownIcon />}
isDisabled={props.isDisabled}
onClick={() => someHeadingsEnabled && setOpen(!isOpen)}
className={styles.button}
>
{LABELS[selected]}
</Button>
</Menu.Trigger>
<Menu.List testId="dropdown-heading-list">
{' '}
{Object.keys(LABELS)
.map(
(nodeType) =>
Expand Down

0 comments on commit a46a030

Please sign in to comment.