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

🐛 [#3001] Fix clickable case status-button #1592

Merged
merged 2 commits into from
Feb 4, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ function initFilterBar() {
expandIcon.setAttribute('aria-hidden', 'true')
expandIcon.textContent = 'expand_more'

let closeIconWrapper = document.createElement('span')
closeIconWrapper.classList.add('close-icon') // Wrapper only, will get pointer-events
closeIconWrapper.setAttribute('tabindex', '0') // Adding tabindex for keyboard focus

let closeIcon = document.createElement('span')
closeIcon.classList.add('material-icons', 'close-icon')
closeIcon.setAttribute('aria-hidden', 'false') // Hiding element that gets focus is not allowed in accessibility
closeIcon.setAttribute('tabindex', '0') // Adding tabindex for keyboard focus
closeIcon.classList.add('material-icons')
closeIcon.textContent = 'close'
closeIcon.setAttribute('aria-hidden', 'true') // Hiding iconfont for accessibility
closeIconWrapper.appendChild(closeIcon) // Add icon to wrapper for pointer-events

// Add text and icons based on selected filters
if (selectedFilters.length === 0) {
Expand All @@ -67,15 +71,15 @@ function initFilterBar() {
ellipsisSpan.classList.add('ellipsis')
ellipsisSpan.textContent = selectedFilters[0]
selectButton.appendChild(ellipsisSpan)
selectButton.appendChild(closeIcon)
selectButton.appendChild(closeIconWrapper) // Append wrapper
selectButton.classList.add('active')
} else {
selectButton.textContent = 'Status '
const activeFilterSpan = document.createElement('span')
activeFilterSpan.classList.add('active-filters')
activeFilterSpan.textContent = `${selectedFilters.length} actieve filters`
selectButton.appendChild(activeFilterSpan)
selectButton.appendChild(closeIcon)
selectButton.appendChild(closeIconWrapper) // Append wrapper
selectButton.classList.add('active')
}

Expand All @@ -90,13 +94,14 @@ function initFilterBar() {
}
}

closeIcon.addEventListener('click', function (event) {
closeIconWrapper.addEventListener('click', function (event) {
// Listen on wrapper
event.stopPropagation()
handleClose()
})

// Add accessibility functionality for close icon
closeIcon.addEventListener('keydown', function (event) {
// Add accessibility functionality for close icon-wrapper
closeIconWrapper.addEventListener('keydown', function (event) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
handleClose()
Expand Down
23 changes: 16 additions & 7 deletions src/open_inwoner/scss/components/FilterBar/MultiSelectListbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
&:has(.show) {
.button__select {
*[class*='icons'] {
display: flex;
position: absolute;
right: var(--spacing-large);
top: 11px;
transform: rotate(180deg);
pointer-events: none;
}
}

Expand Down Expand Up @@ -69,8 +65,6 @@

*[class*='icons'] {
color: var(--color-white);
position: absolute;
right: 12px;
}

.ellipsis {
Expand All @@ -90,6 +84,21 @@
}
}

#selectButton .close-icon {
border-radius: var(--border-radius);
display: flex;
height: var(--spacing-large);
width: var(--spacing-large);
position: absolute;
right: var(--spacing-large);
top: 11px;

&:focus,
&:focus-visible {
border: var(--border-width-thin) solid var(--color-secondary-lighter);
}
}

.multiselect-listbox__content {
position: static;
opacity: 1;
Expand Down
1 change: 0 additions & 1 deletion src/open_inwoner/scss/components/Status/_StatusList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
font-weight: normal;
justify-content: space-between;
padding: 0;
pointer-events: none;
margin: 0;
width: 100%;
}
Expand Down
Loading