Skip to content

Commit

Permalink
Fix selection widget stealing focus after focusing another cell
Browse files Browse the repository at this point in the history
This takes into account widgets like suggest-box where active element that triggers show selection
may not be the input.

RM-63743
  • Loading branch information
pdo-axelor authored and pbe-axelor committed Jun 13, 2023
1 parent d70041d commit 6e29b93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions axelor-web/src/main/webapp/js/form/form.input.select.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ ui.formWidget('BaseSelect', {
input.addClass('.x-focus');
doSetup(input);
setTimeout(function () {
var inSlickEditor = input.parents(".slick-editor").first().length;
if (input.is(':focus') || inSlickEditor) {
var inSlickEditor = input.parents(".slick-editor").first().length > 0;
function isSlickEditorFocused() {
var active = $(document.activeElement);
return inSlickEditor && (!active.is("input, textarea") || active.is(input));
}
if (input.is(':focus') || isSlickEditorFocused()) {
input.autocomplete("search" , '');
input.removeClass('.x-focus');
if (inSlickEditor) input.focus();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Fix selection widget stealing focus after focusing another cell
type: fix

0 comments on commit 6e29b93

Please sign in to comment.