Autocomplete: dropdown never flips above the field (opens below the viewport) and is clipped by the fieldset "overflow: clip"
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, php, symfony
- Ambito
- accessibility, frontend
Direzione di ricerca
Start with assets/js/autocomplete.js and the theme CSS for .form-fieldset-body; the issue identifies both as sources of the dropdown placement and clipping behavior. Review the autocomplete setup and existing fieldset overflow rules, then reproduce the reported behavior in a short viewport and with the clipping mitigation disabled. Done means the dropdown remains visible near the viewport edge and is not clipped inside fieldsets; the payload does not name a test file.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
A ChoiceField / autocomplete placed as the last field of a fieldset opens its TomSelect list downwards — and nothing flips or clamps it, so when the field sits near the lower edge of the window the list opens (almost) entirely below the viewport: the user clicks the select and sees an empty/near-empty dropdown.
The bundled TomSelect has no placement logic at all: positionDropdown() returns immediately unless dropdownParent === 'body', and even then it positions the list strictly below the control (top = control.offsetHeight + rect.top + window.scrollY). There is no flip/clamp in 2.4.1 (the version pinned in yarn.lock) and none in upstream master (2.6.2). When the wrapper is not body, the position comes from the theme CSS (inset-block-start: 100%), i.e. always below. EA never sets dropdownParent when creating the widget (assets/js/autocomplete.js — grep dropdownParent finds nothing from 5.2.0 to 5.7.0).
Measured on a settings CRUD form (EA 5.6.1, Symfony 7.x, PHP 8.x), 249 px tall list, control at y = 257:
| viewport height | list position | really visible in the viewport |
|---|---|---|
| 700 px | 290–539 px | 246 px |
| 540 px | 290–539 px | 246 px |
| 480 px | 290–539 px | 186 px |
| 400 px | 290–539 px | 108 px |
| ≤ 290 px | 290–539 px | 0 px (the document does grow, so a manual scroll reaches it — but the list is not visible when it opens) |
So the smaller the window (or the lower the field after scrolling), the worse it gets; in a short window the dropdown looks like it "does not open".
Second, related problem: the list is rendered inside the clipped fieldset body
TomSelect appends .ts-dropdown inside the field wrapper (.ts-wrapper), i.e. inside .form-fieldset-body, which has overflow: clip for the collapse animation. EA mitigates that with:
.form-fieldset-body.show:not(.collapsing) {
overflow-inline: clip;
overflow-block: visible;
}
That mitigation depends on the overflow-inline / overflow-block logical longhands, and only covers .show:not(.collapsing). Where the longhands do not apply (Chrome < 135, Safari < 26, WebView — see also #7235 and #7050, where these logical overflow properties caused autocomplete problems on Safari and mobile Chrome) or while a body is collapsed/animating, the physical overflow: clip wins and only ~18 px of the list are painted — the dropdown looks invisible even in a tall window.
Reproduction of that half (any browser — just drop the mitigation in DevTools):
.form-fieldset-body.show:not(.collapsing) { overflow: clip !important; }
.form-fieldset-body.show:not(.collapsing) > .row { overflow: clip !important; }
Measured with document.elementFromPoint() probes at 1280×700 (Chrome 155 and Firefox 158): the fieldset body box is 144–311 px, .ts-dropdown is 290–539 px; painted dropdown goes from 18 px (290–308) to 240 px (292–532) as soon as the mitigation applies.
Suggested fix
- Placement (the reported symptom): position the list against the viewport — flip above the control or clamp its height/max-height when there is not enough room below. TomSelect upstream has no such logic, so it has to live in
assets/js/autocomplete.js/ the EA theme. - Clipping: set
dropdownParent: 'body'when creating the widget inassets/js/autocomplete.js— the list then leaves the clipped box (verified here:parentElementof.ts-dropdownbecomes<body>, no clipping ancestor remains, and TomSelect keeps re-anchoring it to the control on window scroll/resize). Alternatively applyoverflow: cliponly while a fieldset is actually collapsing (.form-fieldset-body.collapsing,.collapse:not(.show)) instead of on every body, or clip withclip-pathonly during the animation and drop it afterwards.
Workaround for users (documented hook)
document.addEventListener('ea.autocomplete.pre-connect', (event) => {
event.detail.config.dropdownParent = 'body';
});
Environment
- EasyAdminBundle 5.6.1 (the clipping CSS is present in 5.2.0 … 5.7.0)
- TomSelect 2.4.1 (
yarn.lock); upstream 2.6.2 has the samepositionDropdown() - Symfony 7.x, PHP 8.x
- Reported by a user on Firefox 157 (Linux, 1920×1000 window; the field ends up near the lower window edge): "when the dropdown is at the bottom, you can't see it when it opens". Verified with Chrome 155 and Firefox 158.
- Lingua principale
- PHP
- Stelle
- 4.3k
- Fork
- 1.1k
- Merge medio
- 2g 9h
- PR unite (30g)
- 52
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di EasyCorp/EasyAdminBundle
-
bug design
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
EasyCorp/EasyAdminBundle#7958 ·
I maintainer di solito rispondono entro 2 giorni
-
design feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
EasyCorp/EasyAdminBundle#7930 ·
I maintainer di solito rispondono entro 2 giorni
-
design
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 88/100
EasyCorp/EasyAdminBundle#7879 ·
I maintainer di solito rispondono entro 2 giorni
-
design
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
EasyCorp/EasyAdminBundle#7875 ·
I maintainer di solito rispondono entro 2 giorni
-
#[AdminRoute]: the requirements of an action silently replace the ones of the classForse già presa @anthonyhacart l’ha presa 1 giorno fa. Apertafeature
Difficoltà 3/5 Mezza giornata Idoneità per principianti 30/100
EasyCorp/EasyAdminBundle#7956 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di EasyCorp/EasyAdminBundle
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
taskforcesh/bullmq#5238 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itForse già presa @bfs2021 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Automattic/jetpack#55517 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
-
area/import type/enhancement when/later
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno