Fix search box out of screen (#2650)

Programatically set search results max height
This commit is contained in:
Alexander Skvortsov 2021-03-07 16:31:23 -05:00 committed by GitHub
parent acd9fa8e3e
commit eec39ec426
2 changed files with 7 additions and 1 deletions

View File

@ -113,6 +113,13 @@ export default class Search extends Component {
onupdate() {
// Highlight the item that is currently selected.
this.setIndex(this.getCurrentNumericIndex());
// Since extensions might add elements above the search box on mobile,
// we need to calculate and set the max height dynamically.
const resultsElementMargin = 14;
const maxHeight =
window.innerHeight - this.element.querySelector('.Search-input>.FormControl').getBoundingClientRect().bottom - resultsElementMargin;
this.element.querySelector('.Search-results').style['max-height'] = `${maxHeight}px`;
}
oncreate(vnode) {

View File

@ -15,7 +15,6 @@
}
}
.Search-results {
max-height: 70vh;
overflow: auto;
left: auto;
right: 0;