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

[Facets] update visual representation of facets operators #3061

Merged
merged 1 commit into from
Oct 20, 2023
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
42 changes: 37 additions & 5 deletions assets/component-facets.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,34 @@
transition: text-decoration var(--duration-short) ease;
}

.facets__summary:hover span {
.facets__summary:hover .facets__summary-label {
text-decoration: underline;
text-underline-offset: 0.3rem;
}

.facets__and-helptext {
color: rgba(var(--color-foreground), 0.5);
font-size: calc(var(--font-heading-scale) * 1.2rem);
line-height: calc(var(--font-heading-scale) * 1.2rem);
}

@media only screen and (min-width: 750px) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's worth pointing out that all the other media query changes are grouped into a single media query at the bottom of this css file. For what it's worth, I prefer colocation which you've done here, but it is different than the pattern established. Again, I like what you've done here, but wanted to point it out and let you decide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer colocation by far (and there are 2 media queries at the beguinning of the file :P which is why I allowed myself to do this)

.facets__and-helptext {
font-size: calc(var(--font-heading-scale) * 1.3rem);
line-height: calc(var(--font-heading-scale) * 1.3rem);
}
}

.facets__disclosure .facets__and-helptext,
.facets__disclosure-vertical .facets__and-helptext {
display: none;
}

.facets__disclosure[open] .facets__and-helptext,
.facets__disclosure-vertical[open] .facets__and-helptext {
display: block;
}

.disclosure-has-popup[open] > .facets__summary::before {
z-index: 2;
}
Expand Down Expand Up @@ -268,6 +291,10 @@
z-index: 1;
}

.facets__header facet-remove {
align-self: center;
}

.facets__list {
padding: 0.5rem 2rem;
}
Expand Down Expand Up @@ -768,14 +795,20 @@ details.menu-opening .mobile-facets__close svg {
.mobile-facets__close-button {
align-items: center;
background-color: transparent;
display: flex;
font-size: 1.4rem;
font: inherit;
letter-spacing: inherit;
margin-top: 1.5rem;
padding: 1.2rem 2.6rem;
text-decoration: none;
width: calc(100% - 5.2rem);

display: grid;
Copy link
Contributor

Choose a reason for hiding this comment

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

Clever

grid-template-columns: min-content 1fr;
text-align: start;
}

.mobile-facets__close-button > .facets__and-helptext {
grid-column-start: 2;
}

.no-js .mobile-facets__close-button {
Expand Down Expand Up @@ -830,8 +863,7 @@ details.menu-opening .mobile-facets__close svg {
margin-left: auto;
}

.mobile-facets__summary > div,
.facets__summary > div {
.mobile-facets__summary > div {
display: flex;
align-items: center;
}
Expand Down
8 changes: 6 additions & 2 deletions assets/facets.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,17 @@ class FacetFiltersForm extends HTMLElement {

if (countsToRender) {
const closestJSFilterID = event.target.closest('.js-filter').id;
const currentActiveID = document.activeElement.id;

if (closestJSFilterID) {
FacetFiltersForm.renderCounts(countsToRender, event.target.closest('.js-filter'));
FacetFiltersForm.renderMobileCounts(countsToRender, document.getElementById(closestJSFilterID));

const newElementToActivate = document.getElementById(currentActiveID);
const newElementSelector = document
.getElementById(closestJSFilterID)
.classList.contains('mobile-facets__details')
? `#${closestJSFilterID} .mobile-facets__close-button`
: `#${closestJSFilterID} .facets__summary`;
const newElementToActivate = document.querySelector(newElementSelector);
if (newElementToActivate) newElementToActivate.focus();
}
}
Expand Down
3 changes: 2 additions & 1 deletion locales/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Премахване на филтъра",
"filter_selected_accessibility": "{{ type }} ({{ count }} избрани филтъра)",
"show_more": "Покажи повече",
"show_less": "Покажи по-малко"
"show_less": "Покажи по-малко",
"filter_and_operator_subtitle": "Изрявняване за всички"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"clear_filter": "Odebrat filtr",
"filter_selected_accessibility": "{{ type }} (počet vybraných filtrů: {{ count }})",
"show_more": "Zobrazit více",
"show_less": "Zobrazit méně"
"show_less": "Zobrazit méně",
"filter_and_operator_subtitle": "Shoda se všemi kritérii"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Fjern filter",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtre er valgt)",
"show_more": "Vis mere",
"show_less": "Vis mindre"
"show_less": "Vis mindre",
"filter_and_operator_subtitle": "Match alle"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Filter entfernen",
"filter_selected_accessibility": "{{ type }} ({{ count }} Filter ausgewählt)",
"show_more": "Mehr anzeigen",
"show_less": "Weniger anzeigen"
"show_less": "Weniger anzeigen",
"filter_and_operator_subtitle": "Allen entsprechen"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Κατάργηση φίλτρου",
"filter_selected_accessibility": "{{ type }} (επιλέχθηκαν {{ count }} φίλτρα)",
"show_more": "Εμφάνιση περισσότερων",
"show_less": "Εμφάνιση λιγότερων"
"show_less": "Εμφάνιση λιγότερων",
"filter_and_operator_subtitle": "Αντιστοιχεί με όλα"
}
},
"templates": {
Expand Down
1 change: 1 addition & 0 deletions locales/en.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"label": "Media gallery"
},
"facets": {
"filter_and_operator_subtitle": "Match all",
Copy link
Contributor

Choose a reason for hiding this comment

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

Localization quality issue found

The following issues may affect the quality of localized translations if they are not addressed:

  • The value Match all for key products.facets.filter_and_operator_subtitle is very short. Short strings are more likely to be misunderstood by translators without context. Please provide additional context for the translators if possible.

Please look out for other instances of this issue in your PR and fix them as well if possible.

Questions about these messages? Hop in the #help-localization Slack channel.

"apply": "Apply",
"clear": "Clear",
"clear_all": "Remove all",
Expand Down
3 changes: 2 additions & 1 deletion locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Eliminar filtro",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtros seleccionados)",
"show_more": "Mostrar más",
"show_less": "Mostrar menos"
"show_less": "Mostrar menos",
"filter_and_operator_subtitle": "Seleccionar todos"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Poista suodatin",
"filter_selected_accessibility": "{{ type }} ({{ count }} suodatinta valittu)",
"show_more": "Näytä enemmän",
"show_less": "Näytä vähemmän"
"show_less": "Näytä vähemmän",
"filter_and_operator_subtitle": "Sovella kaikkia"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Supprimer le filtre",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtres sélectionnés)",
"show_more": "Afficher plus",
"show_less": "Afficher moins"
"show_less": "Afficher moins",
"filter_and_operator_subtitle": "Tout associer"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Ukloni filtar",
"filter_selected_accessibility": "{{ type }} (broj odabranih filtra: {{ count }})",
"show_more": "Prikaži više",
"show_less": "Prikaži manje"
"show_less": "Prikaži manje",
"filter_and_operator_subtitle": "Uskladi sve"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Szűrő eltávolítása",
"filter_selected_accessibility": "{{ type }} ({{ count }} szűrő kiválasztva)",
"show_more": "Több részlet",
"show_less": "Kevesebb részlet"
"show_less": "Kevesebb részlet",
"filter_and_operator_subtitle": "Az összesnek megfelelő"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Hapus filter",
"filter_selected_accessibility": "{{ type }} ({{ count }} filter dipilih)",
"show_more": "Selengkapnya",
"show_less": "Sembunyikan lainnya"
"show_less": "Sembunyikan lainnya",
"filter_and_operator_subtitle": "Cocokkan semua"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Rimuovi filtri",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtri selezionati)",
"show_more": "Mostra di più",
"show_less": "Mostra di meno"
"show_less": "Mostra di meno",
"filter_and_operator_subtitle": "Seleziona tutte"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "絞り込みを削除する",
"filter_selected_accessibility": "{{ type }} ({{ count }}件のフィルターを選択済み)",
"show_more": "さらに表示する",
"show_less": "表示を減らす"
"show_less": "表示を減らす",
"filter_and_operator_subtitle": "すべて一致"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "필터 제거",
"filter_selected_accessibility": "{{ type }}({{ count }}개 필터 선택됨)",
"show_more": "자세히 표시",
"show_less": "간단히 표시"
"show_less": "간단히 표시",
"filter_and_operator_subtitle": "모두 일치"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/lt-LT.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"clear_filter": "Pašalinti filtrą",
"filter_selected_accessibility": "{{ type }} (pasirinkta filtrų: {{ count }})",
"show_more": "Rodyti daugiau",
"show_less": "Rodyti mažiau"
"show_less": "Rodyti mažiau",
"filter_and_operator_subtitle": "Atitikti visas"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Fjern filter",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtre valgt)",
"show_more": "Vis mer",
"show_less": "Vis færre"
"show_less": "Vis færre",
"filter_and_operator_subtitle": "Match alle"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Filter verwijderen",
"filter_selected_accessibility": "{{ type }} ({{ count }} filters geselecteerd)",
"show_more": "Meer weergeven",
"show_less": "Minder weergeven"
"show_less": "Minder weergeven",
"filter_and_operator_subtitle": "Alles matchen"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"clear_filter": "Usuń filtr",
"filter_selected_accessibility": "{{ type }} (wybrano {{ count }} fitry(-ów))",
"show_more": "Pokaż więcej",
"show_less": "Pokaż mniej"
"show_less": "Pokaż mniej",
"filter_and_operator_subtitle": "Dopasuj wszystko"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Remover filtro",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtros selecionados)",
"show_more": "Exibir mais",
"show_less": "Exibir menos"
"show_less": "Exibir menos",
"filter_and_operator_subtitle": "Corresponder todos"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Remover filtro",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtros selecionados)",
"show_more": "Mostrar mais",
"show_less": "Mostrar menos"
"show_less": "Mostrar menos",
"filter_and_operator_subtitle": "Corresponder todos"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/ro-RO.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@
"clear_filter": "Elimină filtrul",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtre selectate)",
"show_more": "Afișează mai mult",
"show_less": "Afișează mai puțin"
"show_less": "Afișează mai puțin",
"filter_and_operator_subtitle": "Potrivește-le pe toate"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"clear_filter": "Снять фильтр",
"filter_selected_accessibility": "{{ type }} (установлены фильтры: {{ count }})",
"show_more": "Показать больше",
"show_less": "Показать меньше"
"show_less": "Показать меньше",
"filter_and_operator_subtitle": "Выбрать все"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/sk-SK.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"clear_filter": "Odstrániť filter",
"filter_selected_accessibility": "{{ type }} (vybrané filtre: {{ count }})",
"show_more": "Zobraziť viac",
"show_less": "Zobraziť menej"
"show_less": "Zobraziť menej",
"filter_and_operator_subtitle": "Spĺňať všetko"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/sl-SI.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"clear_filter": "Odstrani filter",
"filter_selected_accessibility": "{{ type }} (št. izbranih filtrov: {{ count }})",
"show_more": "Prikaži več",
"show_less": "Prikaži manj"
"show_less": "Prikaži manj",
"filter_and_operator_subtitle": "Ustreza vsem"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Ta bort filter",
"filter_selected_accessibility": "{{ type }} ({{ count }}) filter valda",
"show_more": "Visa mer",
"show_less": "Visa mindre"
"show_less": "Visa mindre",
"filter_and_operator_subtitle": "Matcha alla"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "ลบตัวกรองออก",
"filter_selected_accessibility": "{{ type }} (เลือกตัวกรองแล้ว {{ count }} รายการ)",
"show_more": "แสดงมากขึ้น",
"show_less": "แสดงน้อยลง"
"show_less": "แสดงน้อยลง",
"filter_and_operator_subtitle": "ที่ตรงกันทั้งหมด"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Filtreyi kaldır",
"filter_selected_accessibility": "{{ type }} ({{ count }} filtre seçildi)",
"show_more": "Daha fazla göster",
"show_less": "Daha az göster"
"show_less": "Daha az göster",
"filter_and_operator_subtitle": "Tümünü eşleştir"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "Xóa bộ lọc",
"filter_selected_accessibility": "{{ type }} (Đã chọn {{ count }} bộ lọc)",
"show_more": "Hiển thị thêm",
"show_less": "Rút gọn"
"show_less": "Rút gọn",
"filter_and_operator_subtitle": "Phù hợp với tất cả"
}
},
"templates": {
Expand Down
3 changes: 2 additions & 1 deletion locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
"clear_filter": "删除筛选条件",
"filter_selected_accessibility": "{{ type }}(已选择 {{ count }} 个筛选条件)",
"show_more": "显示更多内容",
"show_less": "隐藏部分内容"
"show_less": "隐藏部分内容",
"filter_and_operator_subtitle": "匹配全部"
}
},
"templates": {
Expand Down
Loading