js: Enhance scroll location detection in `ui.focusElement()`
This commit is contained in:
parent
f5ce5d42ef
commit
63452ba250
|
@ -175,8 +175,19 @@
|
|||
$element[0].focus();
|
||||
|
||||
if ($container && $container.length) {
|
||||
$container.scrollTop(0);
|
||||
$container.scrollTop($element.first().position().top);
|
||||
if (! $container.is('.container')) {
|
||||
$container = $container.closest('.container');
|
||||
}
|
||||
|
||||
if ($container.css('display') === 'flex' && $container.is('.container')) {
|
||||
var $controls = $container.find('.controls');
|
||||
var $content = $container.find('.content');
|
||||
$content.scrollTop($element.offsetTopRelativeTo($content) - $controls.outerHeight() - (
|
||||
$element.outerHeight(true) - $element.innerHeight()
|
||||
));
|
||||
} else {
|
||||
$container.scrollTop($element.first().position().top);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue