Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-162026 [Milo][Sev2][Catalog] Group of checkboxes is missing FIELDSET … #537

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions creativecloud/blocks/catalog/catalog.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@
order: 1;
padding: 0;
}

.catalog.app .checkbox-group-id {
top: 0;
left: -2px;
width: 1px;
height: 1px;
position: absolute;
overflow: hidden;
}
21 changes: 20 additions & 1 deletion creativecloud/blocks/catalog/catalog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getLibs } from '../../scripts/utils.js';
import { getLibs, createTag } from '../../scripts/utils.js';

const miloLibs = getLibs('/libs');
const { loadStyle } = await import(`${miloLibs}/utils/utils.js`);
Expand Down Expand Up @@ -65,6 +65,24 @@ export function enableAnalytics(catalog, merchCards, sidenav) {
});
}

function addCheckboxGroupAttributes(sidenav) {
const cbGroup = sidenav.querySelector('merch-sidenav-checkbox-group');
if (!cbGroup) return;

const checkboxGroupId = 'sidenav-checkbox-group-title';
const h3El = cbGroup.shadowRoot.querySelector('h3');
if (!h3El) return;

const groupIdEl = createTag('div', { class: 'checkbox-group-id', id: checkboxGroupId });
groupIdEl.textContent = h3El.textContent;
cbGroup.append(groupIdEl);

cbGroup.querySelectorAll('sp-checkbox').forEach((checkboxEl) => {
checkboxEl.setAttribute('role', 'group');
checkboxEl.setAttribute('aria-labelledby', checkboxGroupId);
});
}

/** container block */
export default async function init(el) {
el.classList.add('app');
Expand All @@ -85,6 +103,7 @@ export default async function init(el) {
const sidenav = await initSidenav(sidenavEl);
el.prepend(sidenav);
await sidenav.updateComplete;
addCheckboxGroupAttributes(sidenav);
if (merchCards) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Agreed. And again, last week I tried to do that and I gave up and now I don't remember why. I created Milo PR for that adobecom/milo#3518 and it works quite nice. So closing this one.

merchCards.sidenav = sidenav;
merchCards.requestUpdate();
Expand Down
Loading