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

Issue1724 autocomplete result list #1726

Merged
merged 11 commits into from
Dec 19, 2024
5 changes: 4 additions & 1 deletion resource/css/skosmos.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
--sidebar-scrollbar-bg: var(--light-color);
--sidebar-scrollbar-thumb: var(--secondary-medium-color);
--search-bg: var(--white-color);
--search-dropdown-bg: var(--light-color);
--search-border: var(--medium-color);
--search-button-bg: var(--dark-color);
--search-button-text: var(--white-color);
Expand Down Expand Up @@ -271,7 +272,7 @@ body {

#search-wrapper .dropdown-menu {
transform: translateY(-1px);
background-color: var(--search-bg);
background-color: var(--search-dropdown-bg);
color: var(--headerbar-text-2);
border: 1px solid var(--search-border);
border-radius: 0;
Expand All @@ -280,6 +281,8 @@ body {
#search-wrapper ul {
padding-top: 0rem;
padding-bottom: 0rem;
max-height: 50vh;
overflow-y: auto;
}

#search-wrapper .autocomplete {
Expand Down
6 changes: 4 additions & 2 deletions resource/js/vocab-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ const vocabSearch = Vue.createApp({
@input="autoComplete()"
@keyup.enter="gotoSearchPage()"
@click="showAutoComplete()">
<ul id="search-autocomplete-results" class="dropdown-menu" :class="{ 'show': showDropdown }"
aria-labelledby="search-field">
<ul id="search-autocomplete-results"
class="dropdown-menu w-100"
:class="{ 'show': showDropdown }"
aria-labelledby="search-field">
<li class="autocomplete-result container" v-for="result in renderedResultsList"
:key="result.prefLabel" >
<template v-if="result.pageUrl">
Expand Down
15 changes: 15 additions & 0 deletions tests/cypress/template/vocab-search-bar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,21 @@ describe('Vocab search bar', () => {
cy.get('li').last().find('b').eq(0).should('have.text', '51')
})
})
it('Long autocomplete result list should have a scroll bar', () => {
// go to YSO vocab front page
cy.visit('/yso/fi/')

// resize the window to smaller size
cy.viewport(1200, 600)

// type a search term and wait for the autocomplete to appear
cy.get('#search-field').type('mu')
cy.get('#search-autocomplete-results').should('be.visible')

// the result list should have a CSS-based scroll
cy.get('#search-autocomplete-results').should('have.css', 'overflow-y', 'auto')
cy.get('#search-autocomplete-results').should('have.css', 'max-height', '300px')
});
});

describe('Cookie Management', () => {
Expand Down
Loading