Skip to content

Commit

Permalink
Describe interface content region with the progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Aug 10, 2023
1 parent f05c0fd commit 52e7767
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/canvas-spinner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useStylesPreviewColors } from '../global-styles/hooks';
const { ProgressBar, Theme } = unlock( componentsPrivateApis );
const { useGlobalStyle } = unlock( blockEditorPrivateApis );

export default function CanvasSpinner() {
export default function CanvasSpinner( { id } ) {
const [ fallbackIndicatorColor ] = useGlobalStyle( 'color.text' );
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
const { highlightedColors } = useStylesPreviewColors();
Expand All @@ -23,7 +23,7 @@ export default function CanvasSpinner() {
return (
<div className="edit-site-canvas-spinner">
<Theme accent={ indicatorColor } background={ backgroundColor }>
<ProgressBar />
<ProgressBar id={ id } />
</Theme>
</div>
);
Expand Down
12 changes: 11 additions & 1 deletion packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import classnames from 'classnames';
import { useMemo } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
import { Notice } from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import { EntityProvider } from '@wordpress/core-data';
import { store as preferencesStore } from '@wordpress/preferences';
import {
Expand Down Expand Up @@ -178,9 +179,14 @@ export default function Editor( { isLoading } ) {
// action in <URLQueryController> from double-announcing.
useTitle( hasLoadedPost && title );

const loadingProgressId = useInstanceId(
CanvasSpinner,
'edit-site-editor__loading-progress'
);

return (
<>
{ isLoading ? <CanvasSpinner /> : null }
{ isLoading ? <CanvasSpinner id={ loadingProgressId } /> : null }
{ isEditMode && <WelcomeGuide /> }
<EntityProvider kind="root" type="site">
<EntityProvider
Expand Down Expand Up @@ -232,6 +238,10 @@ export default function Editor( { isLoading } ) {
) }
</>
}
contentProps={ {
'aria-busy': 'true',
'aria-describedby': loadingProgressId,
} }
secondarySidebar={
isEditMode &&
( ( shouldShowInserter && (
Expand Down

0 comments on commit 52e7767

Please sign in to comment.