mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 02:10:09 +08:00
Fix search box out of screen (#2650)
Programatically set search results max height
This commit is contained in:
parent
acd9fa8e3e
commit
eec39ec426
|
@ -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) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
}
|
||||
}
|
||||
.Search-results {
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
left: auto;
|
||||
right: 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user