Skip to content

Commit 83ef81d

Browse files
authored
Coveo: Fixed suggestions not showing on search bar
Fix rendering coveo suggestions
2 parents 4fd7ae0 + 4d80506 commit 83ef81d

File tree

3 files changed

+93
-82
lines changed

3 files changed

+93
-82
lines changed

assets/css/v2/style.css

Lines changed: 83 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ ol li:last-child {
435435
-webkit-backdrop-filter: blur(20px);
436436
position: sticky;
437437
top: 0;
438-
z-index: 1;
438+
z-index: 2;
439439

440440
.header-container {
441441
display: flex;
@@ -452,9 +452,6 @@ ol li:last-child {
452452
.header__search {
453453
display: block;
454454
width: 14rem;
455-
/* This is a horrible hack to stop coveo overflowing 3500px for no reason. :sad */
456-
transform: translateY(0);
457-
overflow: hidden;
458455
}
459456

460457
.header__product-selector {
@@ -946,7 +943,11 @@ main {
946943

947944
/* MARK: Coveo
948945
*/
949-
#search-v2 {
946+
947+
/* Search results on content */
948+
atomic-search-interface#search-v2 {
949+
position: relative;
950+
z-index: 1;
950951
display: inline-block !important;
951952
width: 95vw;
952953
grid-column: 1 / -1;
@@ -961,101 +962,103 @@ main {
961962
atomic-search-box {
962963
z-index: 0;
963964
}
964-
}
965965

966-
atomic-search-interface {
967-
height: fit-content;
968-
}
966+
atomic-search-layout {
967+
grid-template-areas:
968+
"atomic-section-search"
969+
"atomic-section-status"
970+
"atomic-section-facets"
971+
"atomic-section-main";
972+
973+
grid-template-columns: minmax(50%, 100%) !important;
974+
975+
@media (min-width: 1024px) {
976+
&:has(atomic-search-box) {
977+
grid-template-areas:
978+
"atomic-section-search atomic-section-status"
979+
"atomic-section-facets atomic-section-main "
980+
"atomic-section-facets . " !important;
981+
}
969982

970-
.header-search-box {
971-
&::part(wrapper) {
972-
border-radius: 0;
973-
border-color: oklch(var(--color-foreground));
974-
}
983+
grid-template-areas:
984+
"atomic-section-facets atomic-section-status"
985+
"atomic-section-facets atomic-section-main "
986+
"atomic-section-facets . " !important;
975987

976-
&::part(suggestions-wrapper) {
977-
border-radius: 0;
978-
border-color: oklch(var(--color-foreground));
979-
width: calc(100% + 2px);
980-
margin-inline-start: -1px;
981-
}
988+
grid-template-columns: minmax(17rem, 24rem) minmax(50%, 100%) !important;
989+
column-gap: calc(1.5rem + 2rem) !important;
990+
}
982991

983-
&::part(submit-button-wrapper) {
984-
--atomic-primary: var(--atomic-neutral-dark);
985-
}
986-
}
992+
atomic-layout-section[section="status"] {
993+
/* Override Coveo's width to be full */
994+
margin: var(--atomic-layout-spacing-y) 0;
995+
max-width: 100%;
996+
display: block;
997+
width: 100%;
987998

988-
atomic-refine-toggle {
989-
display: none;
990-
}
999+
.atomic-full-summary-and-sort {
1000+
display: flex;
1001+
flex-direction: column;
1002+
align-items: start;
1003+
gap: 1rem;
1004+
justify-content: space-between;
9911005

992-
@media (max-width: 1024px) {
993-
atomic-refine-toggle {
994-
display: block;
995-
}
996-
}
1006+
@media (min-width: 480px) {
1007+
flex-direction: row;
1008+
align-items: center;
1009+
}
9971010

998-
atomic-query-summary {
999-
/* Show duration */
1000-
&::part(duration) {
1001-
display: inline-block !important;
1002-
}
1003-
}
1011+
atomic-query-summary {
1012+
&::part(duration) {
1013+
display: inline-block !important;
1014+
}
1015+
}
10041016

1005-
atomic-search-layout {
1006-
grid-template-areas:
1007-
"atomic-section-search"
1008-
"atomic-section-status"
1009-
"atomic-section-facets"
1010-
"atomic-section-main";
1017+
atomic-refine-toggle {
1018+
display: none;
10111019

1012-
grid-template-columns: minmax(50%, 100%) !important;
1020+
@media (max-width: 1024px) {
1021+
display: block;
1022+
}
1023+
}
1024+
}
1025+
}
10131026

1014-
@media (min-width: 1024px) {
1015-
grid-template-areas:
1016-
"atomic-section-search atomic-section-status"
1017-
"atomic-section-facets atomic-section-main "
1018-
"atomic-section-facets . " !important;
1027+
atomic-layout-section[section="search"] {
1028+
/* Override Coveo's width to be full */
1029+
width: 100% !important;
1030+
max-width: 100% !important;
1031+
}
10191032

1020-
grid-template-columns: minmax(17rem, 24rem) minmax(50%, 100%) !important;
1021-
column-gap: calc(1.5rem + 2rem) !important;
1033+
atomic-layout-section[section="facets"] {
1034+
margin: var(--atomic-layout-spacing-y) 0;
1035+
}
10221036
}
10231037
}
10241038

1025-
atomic-search-layout atomic-layout-section[section="status"] {
1026-
/* Override Coveo's width to be full */
1027-
max-width: 100%;
1028-
display: block;
1029-
width: 100%;
1030-
}
1031-
1032-
atomic-search-layout atomic-layout-section[section="search"] {
1033-
/* Override Coveo's width to be full */
1034-
width: 100% !important;
1035-
max-width: 100% !important;
1036-
}
1039+
/* Search bar on header */
1040+
atomic-search-interface#search-standalone-header {
1041+
height: fit-content;
10371042

1038-
.atomic-full-summary-and-sort {
1039-
display: flex;
1040-
flex-direction: column;
1041-
align-items: start;
1042-
gap: 1rem;
1043-
justify-content: space-between;
1043+
.header-search-box {
1044+
&::part(wrapper) {
1045+
border-radius: 0;
1046+
border-color: oklch(var(--color-foreground));
1047+
}
10441048

1045-
@media (min-width: 480px) {
1046-
flex-direction: row;
1047-
align-items: center;
1048-
}
1049+
&::part(suggestions-wrapper) {
1050+
border-radius: 0;
1051+
border-color: oklch(var(--color-foreground));
1052+
width: calc(100% + 2px);
1053+
margin-inline-start: -1px;
1054+
}
10491055

1050-
atomic-sort-dropdown::part(label) {
1051-
margin-inline-start: 0;
1056+
&::part(submit-button-wrapper) {
1057+
--atomic-primary: var(--atomic-neutral-dark);
1058+
}
10521059
}
10531060
}
10541061

1055-
#atomic-search-box-xqtsq-popup {
1056-
z-index: 9999;
1057-
}
1058-
10591062
body:not(:has(.main-layout)) header atomic-search-interface {
10601063
/* Show on landing pages */
10611064
display: block;

assets/js/coveo.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ async function atomicCoveo() {
8989

9090
await searchBarSidebar.executeFirstSearch();
9191
}
92+
93+
/* Hide atomic-relevance-inspector */
94+
const shadowElements = searchBarHeader.shadowRoot.childNodes;
95+
for (let i = 0; i < shadowElements.length; i++) {
96+
const val = shadowElements[i];
97+
if (val.localName === 'atomic-relevance-inspector') {
98+
val.style.display = 'none';
99+
break;
100+
}
101+
}
92102
}
93103

94104
document.addEventListener('DOMContentLoaded', async () => {

exampleSite/content/search.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
type: search
33
title: Search
4-
params:
5-
searchOnPage: true
64
url: search.html
75
---

0 commit comments

Comments
 (0)