forge
Explore
Log in

Don't you dare go Hollow

Dropdown enhancement itself hides the form's submit

Browse files at this commit

8f9aed9f58f2b683ff85efc278f657e7d0abd9ddAhmet Kaan GümüşParent: 73b13bc
  • fix
    • dropdown enhancement itself hides the form's submit
Show full message
fix(ui): dropdown enhancement itself hides the form's submit

The → no-script submit used to disappear via a :has([data-dd-done]) rule
— one indirection too many (a soft swap onto a new build can leave the
page on its old in-memory stylesheet, which then keeps the arrows and
drops the chevron). The enhancement now hides the sibling submit with an
owned inline style at the moment it runs, so the state travels with the
DOM, not the cascade.
crates/in-web/src/dropdown.rsmodified+10 -0
@@ -187,6 +187,16 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
187 window.__inAdded(trigger);\187 window.__inAdded(trigger);\
188 select.parentNode.insertBefore(trigger, select);\188 select.parentNode.insertBefore(trigger, select);\
189 window.__inOwn(select, ['dd-native'], []);\189 window.__inOwn(select, ['dd-native'], []);\
190+ /* The form's own submit only serves the no-script path; once \
191+ the select is enhanced it duplicates the autosubmit, so it \
192+ bows out — directly, not via a stylesheet the skin or a \
193+ morph might out-race. */ \
194+ var go = null; \
195+ var sibs = select.parentNode.children; \
196+ for (var si = 0; si < sibs.length; si++) { \
197+ if (sibs[si].tagName === 'BUTTON' && sibs[si].type === 'submit' && !sibs[si].classList.contains('dd-trigger')) { go = sibs[si]; break; } \
198+ } \
199+ if (go) { window.__inOwn(go, [], ['style']); go.style.display = 'none'; } \
190 var panel = document.createElement('div');\200 var panel = document.createElement('div');\
191 panel.className = 'dd-panel';\201 panel.className = 'dd-panel';\
192 panel.setAttribute('role', 'listbox');\202 panel.setAttribute('role', 'listbox');\