Desktop: Accessibility: Make Markdown toolbar scrollable when low on space (#11636)

pull/11679/head
Henry Heino 2025-01-18 04:41:56 -08:00 committed by GitHub
parent c58aac9387
commit ff465767ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 7 deletions

View File

@ -33,6 +33,7 @@ function Toolbar(props: ToolbarProps) {
return (
<ToolbarBase
style={styles.root}
scrollable={true}
items={props.toolbarButtonInfos}
disabled={!!props.disabled}
aria-label={_('Editor actions')}

View File

@ -35,6 +35,7 @@ function NoteToolbar(props: NoteToolbarProps) {
return (
<ToolbarBase
style={styles.root}
scrollable={false}
items={props.toolbarButtonInfos}
disabled={props.disabled}
aria-label={_('Note')}

View File

@ -10,6 +10,7 @@ import { focus } from '@joplin/lib/utils/focusHandler';
interface Props {
themeId: number;
scrollable: boolean;
style: React.CSSProperties;
items: ToolbarItem[];
disabled: boolean;
@ -177,7 +178,7 @@ const ToolbarBaseComponent: React.FC<Props> = props => {
return (
<div
ref={containerRef}
className='editor-toolbar'
className={`editor-toolbar ${props.scrollable ? '-scrollable' : ''}`}
style={props.style}
role='toolbar'
@ -191,7 +192,8 @@ const ToolbarBaseComponent: React.FC<Props> = props => {
<div className='group'>
{centerItemComps}
</div>
<div className='group -right'>
<div className='spacer' />
<div className='group'>
{rightItemComps}
</div>
</div>

View File

@ -7,15 +7,21 @@
padding: var(--joplin-toolbar-padding);
padding-right: var(--joplin-main-padding);
&.-scrollable {
overflow-x: auto;
}
> .group {
display: flex;
flex-direction: row;
box-sizing: border-box;
min-width: 0;
&.-right {
flex: 1;
justify-content: flex-end;
}
min-width: 0;
flex-shrink: 0;
}
> .spacer {
flex-grow: 1;
min-width: 7px;
}
}