diff --git a/packages/react-docs/patternfly-a11y.config.js b/packages/react-docs/patternfly-a11y.config.js index baff9267ad1..546868e2a46 100644 --- a/packages/react-docs/patternfly-a11y.config.js +++ b/packages/react-docs/patternfly-a11y.config.js @@ -14,10 +14,25 @@ const urls = Object.keys(fullscreenRoutes) if (fullscreenRoutes[key].isFullscreenOnly) { return key; } else { + // the default tab for each component/pattern does not have a trailing 'react-demo' or 'react' string in the url + // so we strip the trailing string from those paths. const path = fullscreenRoutes[key].path; - if (path.match(/\/demos\/.*\/react-demos$/g)) { + if (path.match(/\/patterns\/.*\/react-demos$/g)) { return path.replace(/\/react-demos$/, ''); } else { + // some demos have been moved to the component section, so their default tab has a trailing 'react-demos' + if (path.match(/\/components\/.*\/react-demos$/g)){ + if (path.includes('/application-launcher/') || + path.includes('/context-selector/') || + path.includes('/date-and-time-picker/') || + path.includes('/password-generator/') || + path.includes('/password-strength/') || + path.includes('/custom-menus/') || + path.includes('/options-menu/')) { + return path.replace(/\/react-demos$/, ''); + } + } + // all other pages in the components section have a trailing 'react' string in their default tab return path.replace(/\/react$/, ''); } }