Commit 4c0e5b14 by lzd Committed by Torkel Ödegaard

Piechart: fix unit selector when scrolling is required (#18932)

parent e5bf3027
......@@ -59,6 +59,14 @@ export function dropdownTypeahead($compile: any) {
[]
);
const closeDropdownMenu = () => {
$input.hide();
$input.val('');
$button.show();
$button.focus();
elem.removeClass('open');
};
$scope.menuItemSelected = (index: number, subIndex: number) => {
const menuItem = $scope.menuItems[index];
const payload: any = { $item: menuItem };
......@@ -66,6 +74,7 @@ export function dropdownTypeahead($compile: any) {
payload.$subItem = menuItem.submenu[subIndex];
}
$scope.dropdownTypeaheadOnSelect(payload);
closeDropdownMenu();
};
$input.attr('data-provide', 'typeahead');
......@@ -105,6 +114,10 @@ export function dropdownTypeahead($compile: any) {
elem.toggleClass('open', $input.val() === '');
});
elem.mousedown((evt: Event) => {
evt.preventDefault();
});
$input.blur(() => {
$input.hide();
$input.val('');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment