-
Notifications
You must be signed in to change notification settings - Fork 44
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
[FINNA-2373] Fix search filters on smaller screens for sr #3110
base: dev
Are you sure you want to change the base?
Changes from 11 commits
544f55d
c8b766e
9d8fe14
f563216
bc92c6e
36330ef
0bfbcc0
dcfb196
25007eb
111bd71
e085708
ac518d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,14 +163,61 @@ finna.layout = (function finnaLayout() { | |
} | ||
} | ||
|
||
/** | ||
* Sidebar click on mobile | ||
*/ | ||
function onSidebarBtnClick() { | ||
$('.sidebar').toggleClass('open'); | ||
$('.mobile-navigation .sidebar-navigation i').toggleClass('fa-arrow-down'); | ||
$('body').toggleClass('prevent-scroll'); | ||
} | ||
|
||
/** | ||
* Check and keep focus within the search facet list | ||
* @param {object} e Event object | ||
*/ | ||
function onFocusOutOfFacetContainer(e) { | ||
const container = document.querySelector('.side-facets-container-ajax'); | ||
if (!container.contains(e.relatedTarget)) { | ||
container.focus(); | ||
} | ||
} | ||
|
||
/** | ||
* Initialize mobile narrow search | ||
*/ | ||
function initMobileNarrowSearch() { | ||
$('.mobile-navigation .sidebar-navigation, .finna-search-filter-toggle .btn-search-filter, .sidebar .sidebar-close-btn, .sidebar .mylist-bar h1').off('click').on('click', function onClickMobileNav() { | ||
$('.sidebar').toggleClass('open'); | ||
$('.mobile-navigation .sidebar-navigation i').toggleClass('fa-arrow-down'); | ||
$('body').toggleClass('prevent-scroll'); | ||
$('.mobile-navigation .sidebar-navigation, .sidebar .mylist-bar h1').off('click').on('click', function onClickMobileNav() { | ||
onSidebarBtnClick(); | ||
}); | ||
const container = document.querySelector(".side-facets-container-ajax"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pitää tarkistaa, löytyikö container (tyyliin |
||
$('.finna-search-filter-toggle .btn-search-filter, .sidebar .sidebar-close-btn').off('click').on('click', function onClickMobileNav() { | ||
onSidebarBtnClick(); | ||
if (document.querySelector('.sidebar').classList.contains('open')) { | ||
document.activeElement.blur(); | ||
container.querySelector('h1').focus(); | ||
} else { | ||
document.activeElement.blur(); | ||
document.querySelector('.finna-search-filter-toggle .btn-search-filter').focus(); | ||
} | ||
}); | ||
container.tabIndex = '0'; | ||
container.ariaModal = true; | ||
container.querySelector('h1').tabIndex = '0'; | ||
$('.finna-search-filter-toggle .btn-search-filter, .sidebar .sidebar-close-btn').off('keydown').on('keydown', function onClickMobileNav(e) { | ||
if (e.which === 32 || e.which === 13) { | ||
e.preventDefault(); | ||
onSidebarBtnClick(); | ||
if (document.querySelector('.sidebar').classList.contains('open')) { | ||
container.addEventListener('focusout', onFocusOutOfFacetContainer); | ||
document.activeElement.blur(); | ||
container.querySelector('h1').focus(); | ||
} else { | ||
document.activeElement.blur(); | ||
document.querySelector('.finna-search-filter-toggle .btn-search-filter').focus(); | ||
container.removeEventListener('focusout', onFocusOutOfFacetContainer); | ||
} | ||
} | ||
}); | ||
$('.mobile-navigation .sidebar-navigation .active-filters').off('click').on('click', function onClickMobileActiveFilters() { | ||
$('.sidebar').scrollTop(0); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ | |
} | ||
} | ||
|
||
.sidebar :not(.recordProvidedBy) h1, | ||
.sidebar :not(.recordProvidedBy) .side-facets-header-container, | ||
.sidebar > h1, | ||
.sidebar > h2 { | ||
margin-bottom: 5px; | ||
|
@@ -77,6 +77,24 @@ | |
} | ||
} | ||
} | ||
.sidebar .side-facets-header-container { | ||
width: 100%; | ||
display: flex; | ||
justify-content: space-between; | ||
background-color: $brand-primary; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $sidebar-background |
||
color: $sidebar-header-text-color; | ||
padding: 10px 15px; | ||
align-items: baseline; | ||
h1 { | ||
padding: 0; | ||
} | ||
button { | ||
background-color: $brand-primary; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $sidebar-background |
||
color: $sidebar-header-text-color; | ||
border: none; | ||
font-size: 1.2rem; | ||
} | ||
} | ||
|
||
.list-group { | ||
margin-bottom: 5px; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ei ikonin luokkaa kovakoodattuna. Jos pitää JS:ssä vaihtaa ikonia, niin pitää laittaa templaatissa kaksi ikonia, joita vaihdellaan.