Keep modal documentation in the JavaScript plugin docs, refs #2790

This commit is contained in:
Simon Willison 2026-09-17 14:13:17 -07:00
commit 8220413a8a

View file

@ -132,19 +132,6 @@ If you are not using ``just``, the equivalent ``uv run`` commands are:
uv run --group playwright playwright install chromium
uv run --group playwright pytest tests/test_playwright.py --playwright --browser chromium
.. _contributing_modals:
Modal dialogs
-------------
Core dialogs use the same ``<datasette-modal>`` component available to plugins. See :ref:`javascript_plugins_modals` for examples, lifecycle methods, dismissal guards and shared styles.
The implementation lives in ``datasette/static/modal.js`` and ``datasette/static/modal.css``. Dialogs are part of the main document, including those in ``<navigation-search>`` and ``<column-chooser>``. Scope component-specific styles in ``app.css`` to the component or dialog.
Keep focus restoration, backdrop hit testing, busy-state dismissal guards and the Safari Escape/confirmation workaround in the shared component. Each consumer owns its content, submission logic, discard-confirmation policy and cleanup. In particular, preserve the intentional differences between Cancel and Escape in the editing dialogs.
Add lifecycle coverage to ``tests/test_playwright.py`` when changing the shared component. Exercise focus restoration, busy state, nested controls consuming Escape, backdrop clicks and disconnect cleanup. Run these checks in Chromium, Firefox and WebKit; keyboard changes should include real confirmation prompts in WebKit.
.. _contributing_using_fixtures:
Using fixtures