Do not change the dropdownParent of tomselect if it is inside a modal

This ensures that it is properly displayed. Fixes issue #1073
This commit is contained in:
Jan Böhmer 2025-10-19 00:34:31 +02:00
parent 1c8ca6c0a2
commit 4c30cab7c1
7 changed files with 41 additions and 8 deletions

View file

@ -34,6 +34,11 @@ export default class extends Controller {
connect() {
let dropdownParent = "body";
if (this.element.closest('.modal')) {
dropdownParent = null
}
let settings = {
persistent: false,
create: true,
@ -42,7 +47,7 @@ export default class extends Controller {
selectOnTab: true,
//This a an ugly solution to disable the delimiter parsing of the TomSelect plugin
delimiter: 'VERY_L0NG_D€LIMITER_WHICH_WILL_NEVER_BE_ENCOUNTERED_IN_A_STRING',
dropdownParent: 'body',
dropdownParent: dropdownParent,
render: {
item: (data, escape) => {
return '<span>' + escape(data.label) + '</span>';