mosaic-headless 1.35.0 → 1.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +44 -38
- package/assets/templates/platforms/claude-ai.json +1 -1
- package/assets/templates/platforms/claude-code.json +1 -1
- package/assets/templates/platforms/codex-cli.json +1 -1
- package/assets/templates/platforms/copilot.json +1 -1
- package/assets/templates/platforms/gemini-cli.json +1 -1
- package/data/component-wall-verification.csv +2 -1
- package/data/data-class-hierarchy.csv +6 -1
- package/data/default-children.csv +2 -0
- package/data/form-surface-verification.csv +8 -3
- package/data/interaction-types.csv +1 -1
- package/data/menu-verification.csv +35 -0
- package/data/node-properties.csv +15 -10
- package/data/node-types.csv +7 -2
- package/data/node-verification.csv +7 -2
- package/data/placement-rules.csv +7 -2
- package/data/style-properties.csv +4 -4
- package/data/style-state-verification.csv +16 -9
- package/data/style-states.csv +11 -8
- package/data/tutorial-recipes-verification.csv +5 -5
- package/package.json +1 -1
- package/references/design-system.md +39 -0
- package/references/failure-modes.md +12 -4
- package/references/placement.md +5 -5
- package/references/upgrading.md +67 -1
- package/scripts/check-release.mjs +6 -5
- package/sites/_forms.py +53 -11
- package/tools/mo.py +14 -2
- package/tools/probe_accordion.py +1 -1
- package/tools/sweep_components.py +1 -1
- package/tools/sweep_style_states.py +1 -1
- package/tools/verify_components.py +57 -2
- package/tools/verify_menus.py +421 -0
|
@@ -8,7 +8,9 @@ hover-tab,global,div,&:where(.m-tab:not(.m-tab--active)):HOVER,COMPILED,._m:wher
|
|
|
8
8
|
hover-when-link,global,div,"&:where([tabindex]:not([tabindex=""-1""]),a[href]:not([disabled]),button:not([disabled])):HOVER",COMPILED,"._n:where([tabindex]:not([tabindex=""-1""]),a[href]:not([disabled]),button:not([disabled])):"
|
|
9
9
|
____loop_pagination_number--active,node-type,loop-pagination-number,&.m-loop-pagination-number--active,NO_HOST,host loop-pagination-number is COMMIT_500 - committing it breaks the page
|
|
10
10
|
____loop_pagination_number_ellipsis,node-type,loop-pagination-number,&.m-loop-pagination-number-ellipsis,NO_HOST,host loop-pagination-number is COMMIT_500 - committing it breaks the page
|
|
11
|
-
|
|
11
|
+
___accordion-item--opened,node-type,accordion-item,"&.m-accordion-item--opened,.m-accordion-item:where(.m-accordion-item--opened) > &,.m-accordion-item:where(.m-accordion-item--opened) > .m-accordion-title &",NO_HOST,host accordion-item is BROKE_PAGE - committing it breaks the page
|
|
12
|
+
___accordion-item--opening,node-type,accordion-item,"&.m-accordion-item--opening,.m-accordion-item:where(.m-accordion-item--opening) > &,.m-accordion-item:where(.m-accordion-item--opening) > .m-accordion-title &",NO_HOST,host accordion-item is BROKE_PAGE - committing it breaks the page
|
|
13
|
+
___arrow_hidden,node-type,,&:where(.m-slider-arrow--hidden),SKIPPED,no node type declares Mosaic/NodeTypes/Slider/SliderArrow/SliderArrowElementTypeFactoryAbstract.php
|
|
12
14
|
___checkbox-input--checked,node-type,checkbox-input,&:checked,NO_HOST,host checkbox-input is BROKE_PAGE - committing it breaks the page
|
|
13
15
|
___checkbox-input--checkmark,node-type,checkbox-input,&:checked::before,NO_HOST,host checkbox-input is BROKE_PAGE - committing it breaks the page
|
|
14
16
|
___choice--checked,node-type,choice,&:has(:where(input):checked),COMPILED,._h:has(:where(input):checked)
|
|
@@ -16,19 +18,21 @@ ___choice--checked-within,node-type,choice,.m-choice:where(:has(input:checked))
|
|
|
16
18
|
___choice--focus-visible,node-type,choice,&:has(:where(input):focus-visible),COMPILED,._j:has(:where(input):focus-visible)
|
|
17
19
|
___choice-field--invalid,node-type,choice-field,&:has(:user-invalid),COMPILED,._h:has(:user-invalid)
|
|
18
20
|
___choice-field--invalid-within,node-type,choice-field,.m-choice-field:where(:has(:user-invalid)) &,COMPILED,.m-choice-field:where(:has(:user-invalid)) ._k
|
|
21
|
+
___dropdown--opened,node-type,,"&.m-dropdown:where(.dropdown--opened),.m-dropdown:where(.dropdown--opened) > &,.m-dropdown:where(.dropdown--opened) > :where( .m-dropdown-toggle) &",SKIPPED,no node type declares Mosaic/NodeTypes/Menu/Dropdown/DropdownElementTypeFactoryAbstract.php
|
|
19
22
|
___dropdown--opening,node-type,,.m-dropdown:where(.dropdown--opening) &,SKIPPED,no node type declares Mosaic/NodeTypes/Menu/Dropdown/DropdownElementTypeFactoryAbstract.php
|
|
20
23
|
___dropdown-toggle--current,node-type,dropdown-toggle,&.m-dropdown-toggle--current,COMPILED,._h.m-dropdown-toggle--current
|
|
21
24
|
___dropdown-toggle--current-within,node-type,dropdown-toggle,".m-dropdown:where(:has(.m-menu-link--current,.m-dropdown-toggle--current)) > &",COMPILED,".m-dropdown:where(:has(.m-menu-link--current,.m-dropdown-toggle--current)) > ._i"
|
|
22
|
-
___field--focus-visible,node-type,field,"&:has(:where(input, textarea, select):focus-visible)",COMPILED,"._h:has(:where(input, textarea, select):focus-visible)"
|
|
23
|
-
___field--invalid,node-type,field
|
|
24
|
-
___field--invalid-focus-visible,node-type,field
|
|
25
|
-
___field--invalid-within,node-type,field
|
|
26
|
-
___field-set--invalid,node-type,fieldset
|
|
25
|
+
___field--focus-visible,node-type,field,"&:has(:where(input, textarea, select, .m-select-toggle):focus-visible)",COMPILED,"._h:has(:where(input, textarea, select, .m-select-toggle):focus-visible)"
|
|
26
|
+
___field--invalid,node-type,field,"&:has(:user-invalid, :where(.m-select-toggle[aria-invalid=""true""]))",COMPILED,"._i:has(:user-invalid, :where(.m-select-toggle[aria-invalid=""true""]))"
|
|
27
|
+
___field--invalid-focus-visible,node-type,field,"&:has(:user-invalid:focus-visible, :where(.m-select-toggle:focus-visible ~ :user-invalid, .m-select-toggle[aria-invalid=""true""]:focus-visible))",COMPILED,"._j:has(:user-invalid:focus-visible, :where(.m-select-toggle:focus-visible ~ :user-invalid"
|
|
28
|
+
___field--invalid-within,node-type,field,".m-field:where(:has(:user-invalid, .m-select-toggle[aria-invalid=""true""])) &",COMPILED,".m-field:where(:has(:user-invalid, .m-select-toggle[aria-invalid=""true""])) ._k"
|
|
29
|
+
___field-set--invalid,node-type,fieldset,"&:has(:user-invalid, :where(.m-select-toggle[aria-invalid=""true""]))",COMPILED,"._h:has(:user-invalid, :where(.m-select-toggle[aria-invalid=""true""]))"
|
|
27
30
|
___fileupload-input--selector-button,node-type,fileupload-input,&::file-selector-button,COMPILED,._h::file-selector-button
|
|
28
31
|
___fileupload-input--selector-button-hover,node-type,fileupload-input,&::file-selector-button:hover,COMPILED,._i::file-selector-button:hover
|
|
29
32
|
___form--error,node-type,form-wrapper,"&[data-form-state=""error""]",COMPILED,"._h[data-form-state=""error""]"
|
|
30
|
-
___form--invalid-within,node-type,form-wrapper
|
|
33
|
+
___form--invalid-within,node-type,form-wrapper,".m-form-wrapper:where(:has(:user-invalid, .m-select-toggle[aria-invalid=""true""])) &",COMPILED,".m-form-wrapper:where(:has(:user-invalid, .m-select-toggle[aria-invalid=""true""])) ._k"
|
|
31
34
|
___input--placeholder,node-type,text-input,&.m-input::placeholder,COMPILED,._h.m-input::placeholder
|
|
35
|
+
___listbox-option,node-type,listbox,&.m-listbox :where(option),COMPILED,._h.m-listbox :where(option)
|
|
32
36
|
___loop_element_no_result,node-type,loop,&.m-loop--no-result,NO_HOST,host loop is COMMIT_500 - committing it breaks the page
|
|
33
37
|
___loop_pagination_button--disabled,node-type,loop-pagination-button-next,&.m-loop-pagination-button--disabled,NO_HOST,host loop-pagination-button-next is BROKE_PAGE - committing it breaks the page
|
|
34
38
|
___menu-link--current,node-type,menu-link,&.m-menu-link--current,COMPILED,._h.m-menu-link--current
|
|
@@ -36,10 +40,13 @@ ___navbar--dropdown-mode,node-type,navbar,"&:where(.m-navbar.dropdown-mode,.m-na
|
|
|
36
40
|
___navbar--opened,node-type,navbar,.dropdown-mode:where(.m-navbar.dropdown--opened) &,COMPILED,.dropdown-mode:where(.m-navbar.dropdown--opened) ._i
|
|
37
41
|
___navbar--opening,node-type,navbar,.dropdown-mode:where(.m-navbar.dropdown--opening) &,COMPILED,.dropdown-mode:where(.m-navbar.dropdown--opening) ._j
|
|
38
42
|
___nested_dropdown_mode,node-type,,"&:where(.dropdown-mode .m-navbar-navigation .m-dropdown &, .m-dropdown .m-dropdown &):not(x)",SKIPPED,no node type declares Mosaic/NodeTypes/Menu/Dropdown/DropdownElementTypeFactoryAbstract.php
|
|
43
|
+
___popover--flipped,node-type,popover,"&:where(.m-popover[data-mosaic-popover-flipped],.m-popover[data-mosaic-popover-flipped] &)",COMPILED,"._h:where(.m-popover[data-mosaic-popover-flipped],.m-popover[data-mosaic-popover-flipped] "
|
|
39
44
|
___radio-input--checked,node-type,radio-input,&:checked,NO_HOST,host radio-input is BROKE_PAGE - committing it breaks the page
|
|
40
45
|
___radio-input--checkmark,node-type,radio-input,&:checked::before,NO_HOST,host radio-input is BROKE_PAGE - committing it breaks the page
|
|
41
|
-
___select
|
|
42
|
-
___select-
|
|
46
|
+
___select--opened,node-type,select,"&.m-select:where(.m-select--opened),.m-select:where(.m-select--opened) > &,.m-select:where(.m-select--opened) > .m-select-toggle &,.m-select:where(.m-select--opened) > .m-select-options &",ABSENT,probe element never reached the page
|
|
47
|
+
___select-option--active,node-type,select-option,"&.m-select-option--active,.m-select-option--active &",COMPILED,"._h.m-select-option--active,.m-select-option--active ._h"
|
|
48
|
+
___select-option--in-toggle,node-type,select-option,"&.m-select-current-option,.m-select-current-option &",COMPILED,"._i.m-select-current-option,.m-select-current-option ._i"
|
|
49
|
+
___select-option--selected,node-type,select-option,"&[aria-selected=""true""],&.m-select-option--selected,[aria-selected=""true""] &,.m-select-option--selected &",COMPILED,"._j[aria-selected=""true""],._j.m-select-option--selected,[aria-selected=""true""] ._j,.m-sele"
|
|
43
50
|
___slide--active,node-type,slider-slide,.m-slide--active > &,NO_HOST,host slider-slide is BROKE_PAGE - committing it breaks the page
|
|
44
51
|
___slider_navigation_bullet--active,node-type,slider-navigation-bullet,&.m-slider-bullet--active,NO_HOST,host slider-navigation-bullet is COMMIT_500 - committing it breaks the page
|
|
45
52
|
___slider_navigation_bullet--hover,node-type,slider-navigation-bullet,&:not(.m-slider-bullet--active):HOVER,NO_HOST,host slider-navigation-bullet is COMMIT_500 - committing it breaks the page
|
package/data/style-states.csv
CHANGED
|
@@ -23,16 +23,17 @@ ___dropdown--opened,"&.m-dropdown:where(.dropdown--opened),.m-dropdown:where(.dr
|
|
|
23
23
|
___dropdown--opening,.m-dropdown:where(.dropdown--opening) &,600,node-type,Mosaic/NodeTypes/Menu/Dropdown/DropdownElementTypeFactoryAbstract.php
|
|
24
24
|
___dropdown-toggle--current,&.m-dropdown-toggle--current,500,node-type,Mosaic/NodeTypes/Menu/Dropdown/DropdownToggle/DropdownToggleElementTypeFactory.php
|
|
25
25
|
___dropdown-toggle--current-within,".m-dropdown:where(:has(.m-menu-link--current,.m-dropdown-toggle--current)) > &",500,node-type,Mosaic/NodeTypes/Menu/Dropdown/DropdownToggle/DropdownToggleElementTypeFactory.php
|
|
26
|
-
___field--focus-visible,"&:has(:where(input, textarea, select):focus-visible)",760,node-type,Mosaic/NodeTypes/Form/Form/MElements/Field/FieldElementTypeFactory.php
|
|
27
|
-
___field--invalid
|
|
28
|
-
___field--invalid-focus-visible
|
|
29
|
-
___field--invalid-within
|
|
30
|
-
___field-set--invalid
|
|
26
|
+
___field--focus-visible,"&:has(:where(input, textarea, select, .m-select-toggle):focus-visible)",760,node-type,Mosaic/NodeTypes/Form/Form/MElements/Field/FieldElementTypeFactory.php
|
|
27
|
+
___field--invalid,"&:has(:user-invalid, :where(.m-select-toggle[aria-invalid=""true""]))",700,node-type,Mosaic/NodeTypes/Form/Form/MElements/Field/FieldElementTypeFactory.php
|
|
28
|
+
___field--invalid-focus-visible,"&:has(:user-invalid:focus-visible, :where(.m-select-toggle:focus-visible ~ :user-invalid, .m-select-toggle[aria-invalid=""true""]:focus-visible))",770,node-type,Mosaic/NodeTypes/Form/Form/MElements/Field/FieldElementTypeFactory.php
|
|
29
|
+
___field--invalid-within,".m-field:where(:has(:user-invalid, .m-select-toggle[aria-invalid=""true""])) &",700,node-type,Mosaic/NodeTypes/Form/Form/MElements/Field/FieldElementTypeFactory.php
|
|
30
|
+
___field-set--invalid,"&:has(:user-invalid, :where(.m-select-toggle[aria-invalid=""true""]))",700,node-type,Mosaic/NodeTypes/Form/Form/MElements/FieldSet/FieldSetElementTypeFactory.php
|
|
31
31
|
___fileupload-input--selector-button,&::file-selector-button,0,node-type,Mosaic/NodeTypes/Form/Form/MElements/FileUpload/FileUploadElementTypeFactory.php
|
|
32
32
|
___fileupload-input--selector-button-hover,&::file-selector-button:hover,100,node-type,Mosaic/NodeTypes/Form/Form/MElements/FileUpload/FileUploadElementTypeFactory.php
|
|
33
33
|
___form--error,"&[data-form-state=""error""]",700,node-type,Mosaic/NodeTypes/Form/FormWrapperElementTypeFactory.php
|
|
34
|
-
___form--invalid-within
|
|
34
|
+
___form--invalid-within,".m-form-wrapper:where(:has(:user-invalid, .m-select-toggle[aria-invalid=""true""])) &",700,node-type,Mosaic/NodeTypes/Form/FormWrapperElementTypeFactory.php
|
|
35
35
|
___input--placeholder,&.m-input::placeholder,0,node-type,Mosaic/NodeTypes/Form/Form/MElements/InputText/InputTextElementTypeFactory.php
|
|
36
|
+
___listbox-option,&.m-listbox :where(option),500,node-type,Mosaic/NodeTypes/Form/Form/MElements/ListBox/ListBoxElementTypeFactory.php
|
|
36
37
|
___loop_element_no_result,&.m-loop--no-result,600,node-type,Mosaic/NodeTypes/Loop/LoopElementTypeFactory.php
|
|
37
38
|
___loop_pagination_button--disabled,&.m-loop-pagination-button--disabled,800,node-type,Mosaic/NodeTypes/Loop/LoopPagination/Button/ButtonNext/LoopPaginationButtonNextElementTypeFactory.php
|
|
38
39
|
___menu-link--current,&.m-menu-link--current,500,node-type,Mosaic/NodeTypes/Menu/MenuLink/MenuLinkElementTypeFactory.php
|
|
@@ -43,8 +44,10 @@ ___nested_dropdown_mode,"&:where(.dropdown-mode .m-navbar-navigation .m-dropdown
|
|
|
43
44
|
___popover--flipped,"&:where(.m-popover[data-mosaic-popover-flipped],.m-popover[data-mosaic-popover-flipped] &)",600,node-type,Mosaic/NodeTypes/Pro/Popover/PopoverElementTypeFactory.php
|
|
44
45
|
___radio-input--checked,&:checked,500,node-type,Mosaic/NodeTypes/Form/Form/MElements/Radio/RadioInput/RadioInputElementTypeFactory.php
|
|
45
46
|
___radio-input--checkmark,&:checked::before,500,node-type,Mosaic/NodeTypes/Form/Form/MElements/Radio/RadioInput/RadioInputElementTypeFactory.php
|
|
46
|
-
___select
|
|
47
|
-
___select-
|
|
47
|
+
___select--opened,"&.m-select:where(.m-select--opened),.m-select:where(.m-select--opened) > &,.m-select:where(.m-select--opened) > .m-select-toggle &,.m-select:where(.m-select--opened) > .m-select-options &",600,node-type,Mosaic/NodeTypes/Form/Form/MElements/Select/SelectElementTypeFactory.php
|
|
48
|
+
___select-option--active,"&.m-select-option--active,.m-select-option--active &",500,node-type,Mosaic/NodeTypes/Form/Form/MElements/Select/Options/Option/SelectOptionElementTypeFactory.php
|
|
49
|
+
___select-option--in-toggle,"&.m-select-current-option,.m-select-current-option &",600,node-type,Mosaic/NodeTypes/Form/Form/MElements/Select/Options/Option/SelectOptionElementTypeFactory.php
|
|
50
|
+
___select-option--selected,"&[aria-selected=""true""],&.m-select-option--selected,[aria-selected=""true""] &,.m-select-option--selected &",400,node-type,Mosaic/NodeTypes/Form/Form/MElements/Select/Options/Option/SelectOptionElementTypeFactory.php
|
|
48
51
|
___slide--active,.m-slide--active > &,500,node-type,Mosaic/NodeTypes/Slider/SliderSlides/SliderSlide/SliderSlideElementTypeFactory.php
|
|
49
52
|
___slider_navigation_bullet--active,&.m-slider-bullet--active,500,node-type,Mosaic/NodeTypes/Slider/SliderNavigation/SliderNavigationBullet/SliderNavigationBulletElementTypeFactory.php
|
|
50
53
|
___slider_navigation_bullet--hover,&:not(.m-slider-bullet--active):HOVER,100,node-type,Mosaic/NodeTypes/Slider/SliderNavigation/SliderNavigationBullet/SliderNavigationBulletElementTypeFactory.php
|
|
@@ -5,13 +5,13 @@ DARK,Dark switches the page,PASS,"rgb(250, 250, 245) -> rgb(20, 22, 28)"
|
|
|
5
5
|
DARK,Dark sets the cookie,PASS,rx-mode=dark
|
|
6
6
|
DARK,a reload keeps Dark,PASS,"rgb(20, 22, 28)"
|
|
7
7
|
DARK,Light switches back,PASS,"rgb(250, 250, 245), rx-mode=light"
|
|
8
|
-
LOOP,moves on its own,PASS,
|
|
9
|
-
LOOP,hover suspends it by Interaction ID,PASS,
|
|
10
|
-
LOOP,leaving resumes it,PASS,
|
|
11
|
-
LOOP,still moving past one 4s cycle,PASS,198.
|
|
8
|
+
LOOP,moves on its own,PASS,153.434px -> 182.25px
|
|
9
|
+
LOOP,hover suspends it by Interaction ID,PASS,183.644px = 183.644px
|
|
10
|
+
LOOP,leaving resumes it,PASS,183.644px -> 196.695px
|
|
11
|
+
LOOP,still moving past one 4s cycle,PASS,198.316px -> 0.350098px
|
|
12
12
|
OFFCANV,"odd click opens: display flex, slid in",PASS,"{'bg': 'rgb(240, 240, 240)', 'op': '1', 'd': 'flex', 'tr': '0%'}"
|
|
13
13
|
OFFCANV,even click closes: display none at the end,PASS,"{'bg': 'rgb(240, 240, 240)', 'op': '1', 'd': 'none', 'tr': '100%'}"
|
|
14
|
-
PROGRESS,bar fills as the article scrolls,PASS,-100% -> -55.
|
|
14
|
+
PROGRESS,bar fills as the article scrolls,PASS,-100% -> -55.1729% -> -0.968059%
|
|
15
15
|
REVEAL,first section reveals on scroll,PASS,"{'bg': 'rgb(9, 99, 199)', 'op': '1', 'd': 'block', 'tr': '0px'}"
|
|
16
16
|
REVEAL,second stays hidden until reached,PASS,"{'bg': 'rgb(9, 99, 199)', 'op': '0', 'd': 'block', 'tr': '0px 40px'}"
|
|
17
17
|
REVEAL,second reveals by class alone,PASS,"{'bg': 'rgb(9, 99, 199)', 'op': '1', 'd': 'block', 'tr': '0px'}"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mosaic-headless",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.1",
|
|
4
4
|
"description": "AI-agent skill: build Mosaic Pro (Nextend) WordPress sites by writing the underlying data model directly - 23 custom tables, no visual editor, no DOM. Every node type, style property and node property swept against a live install and asserted on the delivered HTML and compiled CSS. Installs into Claude Code, Cursor, Codex CLI, Gemini CLI, Copilot, Continue, Windsurf and Claude.ai.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wordpress",
|
|
@@ -235,6 +235,45 @@ work; set `openOn:"hover"` if hover is what you want. Style the open look throug
|
|
|
235
235
|
the `___dropdown--opened` state. Menus support one submenu level only - no
|
|
236
236
|
sub-submenus.
|
|
237
237
|
|
|
238
|
+
### Site menus: what each way of building one does, measured
|
|
239
|
+
|
|
240
|
+
There is **no off-canvas node** - not in 1.0.11, not in 1.0.12 (134 types; the
|
|
241
|
+
1.0.12 package searched for offcanvas / off-canvas / drawer), and not on the roadmap.
|
|
242
|
+
Mosaic's "off-canvas menu" is a tutorial (a div and click interactions). The menu
|
|
243
|
+
lab, `tools/verify_menus.py` (`data/menu-verification.csv`, 34 checks on 1.0.12),
|
|
244
|
+
builds every option on one page under a z-index 1000 sticky header and drives it
|
|
245
|
+
with a mouse, the keyboard, a touch tablet and a 390px touch phone:
|
|
246
|
+
|
|
247
|
+
| | desktop `dropdown` / `dropdown-wide`, `openOn: hover` |
|
|
248
|
+
|---|---|
|
|
249
|
+
| hover | opens in ~65 ms (fadeDown), closes ~150 ms after leaving - moving down into the panel does not drop it |
|
|
250
|
+
| keyboard | Space / ArrowDown open it; ArrowDown does NOT move into the links, Tab does; Escape closes and leaves focus on the toggle |
|
|
251
|
+
| toggle with a `url` | renders as `<a href>`; Enter navigates |
|
|
252
|
+
| touch | first tap on a linked toggle opens without navigating; the second tap closes it, still without navigating - so the parent page must be a link INSIDE the panel ("overview" as the first item); a tap outside closes |
|
|
253
|
+
| SEO | every panel link is an `<a href>` in the server HTML, before any script |
|
|
254
|
+
| mega | `dropdown-wide`'s panel spans the viewport (x 0, full width); one submenu level only |
|
|
255
|
+
|
|
256
|
+
| phone menu | Esc | focus | aria | close button vs sticky header |
|
|
257
|
+
|---|---|---|---|---|
|
|
258
|
+
| **(b) Pro `modal` as a drawer** | closes | moves in, Tab is trapped, returns to the opener | `<dialog aria-modal="true" aria-label>` from `accessibleLabel` | top layer: never covered; html/body `overflow: clip` while open |
|
|
259
|
+
| (a) `navbar` below `buttonBreakpoint` | closes | stays on the toggle, no trap | `aria-expanded`, no `aria-controls` | in flow inside the header |
|
|
260
|
+
| (c) div + click odd/even (the tutorial) | **does nothing** | never moves | none | **covered** when its z-index is under the header's |
|
|
261
|
+
|
|
262
|
+
The drawer the lab measures, and the recommendation:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
modal closedby: everything, accessibleLabel, padding 0 (the browser's dialog padding)
|
|
266
|
+
modal-overlay backgroundColor with alpha
|
|
267
|
+
modal-window position absolute, top 0, right 0, height 100dvh (the NATIVE field), width 86%,
|
|
268
|
+
maxWidth 360px, overflow auto; first child: a button with modalClose
|
|
269
|
+
opener a button with click -> modalOpen, target = the modal's nodeID (a uuid5, so a
|
|
270
|
+
rebuild keeps it)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
A notch inset: `paddingTop: "max(16px, env(safe-area-inset-top))"` and the `calc()`
|
|
274
|
+
form are dropped by the native field; the same in `customDeclarations` survives. Mosaic's
|
|
275
|
+
viewport meta has no `viewport-fit=cover`, so `env()` is 0 unless a site adds it.
|
|
276
|
+
|
|
238
277
|
`dropdown-wrapper` used to read as a leaf in `placement-rules.csv`. Its
|
|
239
278
|
`canBeParentFor()` returns `true`, but on `DropdownWrapperElementTypeFactoryAbstract`,
|
|
240
279
|
and the extractor never read the abstract files, so it saw no override and wrote
|
|
@@ -397,14 +397,22 @@ was valid. Every field had been dropped on the way in, for three different reaso
|
|
|
397
397
|
`*ElementMResourceFactory.php` and every extractor here walked
|
|
398
398
|
`*ElementTypeFactory.php` only. Two types were missing from the catalog; the
|
|
399
399
|
walk now covers both and the count went 126 → 128.
|
|
400
|
-
-
|
|
401
|
-
`wysiwyg-text` child
|
|
402
|
-
|
|
400
|
+
- **Up to 1.0.11, `select-option` was a leaf and its label the `text` PROPERTY.**
|
|
401
|
+
A `wysiwyg-text` child rendered an empty label: a dropdown that opened onto five
|
|
402
|
+
blank lines. **1.0.12 reversed it.** `select-input` is gone; the dropdown is now
|
|
403
|
+
`select > select-toggle (select-placeholder, icon) + select-options > select-option`,
|
|
404
|
+
and a `select-option`'s label is a CHILD (`text` > `wysiwyg-text`, or anything
|
|
405
|
+
else) - a `text` property on it is not a declared property any more. The native
|
|
406
|
+
control lives on as `listbox` / `listbox-option`, and THAT option is still the
|
|
407
|
+
leaf with `text`. Writing a 1.0.11 tree to 1.0.12 is the new way to get blank
|
|
408
|
+
options; see `references/upgrading.md` for what the data upgrade rewrote.
|
|
403
409
|
|
|
404
410
|
The through-line is the one this file keeps recording: Mosaic accepts a write it
|
|
405
411
|
cannot use and says nothing. The defence is to read the delivered page back and
|
|
406
412
|
count what arrived — `verify_components.py` now asserts the control count, the option
|
|
407
|
-
labels and that an empty required form is actually refused.
|
|
413
|
+
labels and that an empty required form is actually refused, and on 1.0.12 drives the
|
|
414
|
+
custom select: it opens, a click and the keyboard both pick, the hidden input carries
|
|
415
|
+
the value, and a submit with nothing picked marks the toggle `aria-invalid`.
|
|
408
416
|
|
|
409
417
|
## `display` on an element whose visibility the plugin owns — twice now
|
|
410
418
|
|
package/references/placement.md
CHANGED
|
@@ -19,14 +19,14 @@ component that checks placement, because nothing downstream will.
|
|
|
19
19
|
|
|
20
20
|
## The parent side: `data/placement-rules.csv`
|
|
21
21
|
|
|
22
|
-
One row per node type, extracted from every `canBeParentFor` in the source (
|
|
22
|
+
One row per node type, extracted from every `canBeParentFor` in the source (134 types, 1.0.12):
|
|
23
23
|
|
|
24
24
|
| rule | count | meaning |
|
|
25
25
|
|---|---|---|
|
|
26
|
-
| `none` |
|
|
27
|
-
| `any` |
|
|
28
|
-
| `allow` |
|
|
29
|
-
| `complex` |
|
|
26
|
+
| `none` | 57 | leaf. Refuses every child — the default on `NodeTypeFactoryAbstract`. |
|
|
27
|
+
| `any` | 46 | takes anything. `div`, `body`, `section`, `button`, `menu`, `slider-slide`, `tabs-tab-pane`, … |
|
|
28
|
+
| `allow` | 29 | takes only the types in `allowed_children`. |
|
|
29
|
+
| `complex` | 2 | the body is not a plain `instanceof` chain — `listbox`, `styleguide-entry-content-text-quote`. Read the file named in `declared_in`. |
|
|
30
30
|
|
|
31
31
|
The `allow` rows are the component families, and they are strict. A few worth knowing
|
|
32
32
|
by heart because they are the ones people get wrong:
|
package/references/upgrading.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Upgrading the plugin: what 1.0.7 → 1.0.8 → 1.0.10 → 1.0.11 did to the data, measured
|
|
1
|
+
# Upgrading the plugin: what 1.0.7 → 1.0.8 → 1.0.10 → 1.0.11 → 1.0.12 did to the data, measured
|
|
2
2
|
|
|
3
3
|
A Mosaic plugin update is two events, not one. The files change when WordPress
|
|
4
4
|
installs the package; the DATA changes only when Mosaic's own upgrade flow has
|
|
@@ -340,3 +340,69 @@ runs had left `master-root`, `styleguide-root`, `component-root` and
|
|
|
340
340
|
`parentNodeID` (the master is back to its 7 baseline nodes), and sweep `document`
|
|
341
341
|
on its own, or not at all. Also, the parent is the FIRST div by `ordering` (what
|
|
342
342
|
`--setup` picks); a config rebuilt by hand with another div sends the probes there.
|
|
343
|
+
|
|
344
|
+
## 1.0.11 → 1.0.12
|
|
345
|
+
|
|
346
|
+
**Getting the package.** `wp plugin update mosaic` again: "Updated 1 of 1", the
|
|
347
|
+
right permissions, and `MOSAIC_GLOBAL.dataVersion` / `MOSAIC_SITE.dataVersion` read
|
|
348
|
+
`1.0.12` on the first look afterwards. **The data upgrade now runs on its own, in
|
|
349
|
+
the background** (`MosaicUpgradeLayer/BackgroundUpgrade`); nothing had to be driven.
|
|
350
|
+
`wp plugin list` printed `1.0.11` once, straight after the update, before the
|
|
351
|
+
header read back as 1.0.12 - check `Version:` in `mosaic.php`, not the first list.
|
|
352
|
+
Backups: `wp db export ~/private_html/pre-1012.sql` and a copy of the old folder.
|
|
353
|
+
No duplicate roots afterwards (the health SQL in SKILL.md: 0 groups, 155 roots).
|
|
354
|
+
|
|
355
|
+
**What the migration rewrote: the Select split** (`Upgrade-1.0.12.php`, NEXT-4757,
|
|
356
|
+
written for 1.0.8 and carried forward). The native `select-input` / `select-option`
|
|
357
|
+
pair is gone. Every stored `select-input` became one of two things:
|
|
358
|
+
|
|
359
|
+
- `multiple`, or `size` > 1 → **`listbox`** > `listbox-option` - the native
|
|
360
|
+
`<select class="m-listbox">`, whose option is still a leaf with a `text` property;
|
|
361
|
+
- anything else → the new **`select`**, written out as the factory defaults:
|
|
362
|
+
|
|
363
|
+
```
|
|
364
|
+
select nameAttribute, required, defaultValue; the root keeps width + font
|
|
365
|
+
select-toggle <button role=combobox> - the visible box, the field chrome moved here
|
|
366
|
+
select-placeholder > text (Inherited text) > wysiwyg-text "Please choose an option"
|
|
367
|
+
icon the chevron SVG
|
|
368
|
+
select-options <div role=listbox>
|
|
369
|
+
select-option value, selected; label is a CHILD: text > wysiwyg-text
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Delivered as `<mosaic-select class="m-select">`, plus a hidden
|
|
373
|
+
`<input class="m-select-input" name=…>` that carries the value into the
|
|
374
|
+
submission. The field's invalid / focus-visible state selectors grew a
|
|
375
|
+
`.m-select-toggle[aria-invalid="true"]` arm, because the hidden input is never
|
|
376
|
+
`:user-invalid` - a submit with nothing picked marks the TOGGLE instead. Old
|
|
377
|
+
`___select-input-option*` states became `___listbox-option` on the List box path and
|
|
378
|
+
`___select-option--active` (from a hover) on the Select path; the rest were dropped.
|
|
379
|
+
An empty-valued first option survived the migration as an ordinary option; the
|
|
380
|
+
skill's form builder (`sites/_forms.py`) now turns it into the placeholder instead.
|
|
381
|
+
|
|
382
|
+
**Re-extracted and diffed against 1.0.11:** 134 node types (+7 Select / List box,
|
|
383
|
+
-2), 201 node properties, 131 data classes, 134 placement rules, 27 default
|
|
384
|
+
structures (`select` and `select-toggle` heal their children in), 60 style states
|
|
385
|
+
(`___select--opened`, three option states, `___listbox-option`),
|
|
386
|
+
`gridRow/ColumnStart/End` moved under a `CSSGridChildPositionPropertyFactory`, and
|
|
387
|
+
the `pointerMove` trigger's description gained touch. Pluggables are the same 285.
|
|
388
|
+
`check_tables.py`: every source table matches a fresh extraction.
|
|
389
|
+
|
|
390
|
+
**Re-verified on the live site:** `form-surface` 23/23 (the select opened, picked by
|
|
391
|
+
click and by keyboard, required refused), `component-wall` 27, `content-loop` 15/15,
|
|
392
|
+
`popovers` 37/37, `tokens` 15/15, `dialog-form` 49/49, both sliders 15/15,
|
|
393
|
+
`tutorial-recipes` 16/16, the interaction sweep unchanged (the editor-shape
|
|
394
|
+
candidates still BIND), style states 39 COMPILED of 40 probed, and the seven new
|
|
395
|
+
node types all RENDERED. The 406s some posts return are older than the upgrade:
|
|
396
|
+
those posts have no Mosaic template (`TemplateNotFoundException`).
|
|
397
|
+
|
|
398
|
+
**Two traps hit while doing it, both ours:**
|
|
399
|
+
|
|
400
|
+
- Rebuilding ONE page with `build_site.py` re-fills every component, which re-keys
|
|
401
|
+
their inner nodes (`references/design-system.md`); the other pages that place a
|
|
402
|
+
component keep overrides keyed to the old IDs and fall back to the defaults -
|
|
403
|
+
three identical "專案" cards. Build every page that places a component in the
|
|
404
|
+
same run as the page you changed.
|
|
405
|
+
- `verify_recipes.py --post` binds the recipes template to THAT post. The example
|
|
406
|
+
command said `--post 21`, which on this site is an unrelated probe page; its
|
|
407
|
+
content was replaced and `/probe-recipes/` kept serving an older build. Look the
|
|
408
|
+
ID up first.
|
|
@@ -122,22 +122,23 @@ if (!fs.existsSync(path.join(ROOT, pkg.bin["mosaic-headless"])))
|
|
|
122
122
|
const rows = (p) => tableFiles(p)
|
|
123
123
|
.reduce((n, f) => n + read(f).trim().split("\n").length - 1, 0); // minus each header
|
|
124
124
|
const counts = {
|
|
125
|
-
"data/node-verification.csv":
|
|
125
|
+
"data/node-verification.csv": 134,
|
|
126
126
|
"data/style-verification.csv": 101,
|
|
127
127
|
"data/node-property-verification.csv": 191,
|
|
128
128
|
"data/rwd-verification.csv": 733,
|
|
129
129
|
"data/browser-verification": 4132,
|
|
130
|
-
"data/style-state-verification.csv":
|
|
130
|
+
"data/style-state-verification.csv": 59,
|
|
131
131
|
"data/interaction-verification.csv": 11,
|
|
132
132
|
"data/tutorial-recipes-verification.csv": 16,
|
|
133
|
-
"data/
|
|
133
|
+
"data/menu-verification.csv": 34,
|
|
134
|
+
"data/data-class-hierarchy.csv": 131,
|
|
134
135
|
"data/custom-fields-verification.csv": 62,
|
|
135
136
|
"data/dialog-verification.csv": 19,
|
|
136
137
|
"data/slider-verification.csv": 30,
|
|
137
138
|
"data/token-verification.csv": 15,
|
|
138
139
|
"data/mobile-audit.csv": 68,
|
|
139
|
-
"data/component-wall-verification.csv":
|
|
140
|
-
"data/form-surface-verification.csv":
|
|
140
|
+
"data/component-wall-verification.csv": 27,
|
|
141
|
+
"data/form-surface-verification.csv": 23,
|
|
141
142
|
"data/content-loop-verification.csv": 15,
|
|
142
143
|
"data/navigation-verification.csv": 39,
|
|
143
144
|
"data/page-modal-verification.csv": 19,
|
package/sites/_forms.py
CHANGED
|
@@ -15,8 +15,14 @@ Shapes, read out of the source rather than guessed:
|
|
|
15
15
|
choice-label its text
|
|
16
16
|
radio-input or checkbox-input, carrying `value`
|
|
17
17
|
|
|
18
|
-
select
|
|
19
|
-
select-
|
|
18
|
+
select nameAttribute, required, defaultValue (1.0.12)
|
|
19
|
+
select-toggle the visible box
|
|
20
|
+
select-placeholder > text, shown until something is picked
|
|
21
|
+
icon the chevron
|
|
22
|
+
select-options the list
|
|
23
|
+
select-option value, selected; its label is a CHILD (text)
|
|
24
|
+
listbox the native <select>: multiple, size >= 2
|
|
25
|
+
listbox-option value + its `text` property (a leaf)
|
|
20
26
|
|
|
21
27
|
form-multi-steps
|
|
22
28
|
form-multi-steps-steps > form-multi-steps-step the tab bar
|
|
@@ -82,9 +88,18 @@ def labelled(attr, text, node_type, **data):
|
|
|
82
88
|
])
|
|
83
89
|
|
|
84
90
|
|
|
91
|
+
# the toggle's default chevron, verbatim from SelectToggleElementTypeFactory
|
|
92
|
+
CHEVRON = ('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" '
|
|
93
|
+
'fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" '
|
|
94
|
+
'stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>')
|
|
95
|
+
|
|
96
|
+
|
|
85
97
|
def select(attr, label, name, options, **extra):
|
|
86
98
|
d = {"attrID": attr, "nameAttribute": name}
|
|
87
99
|
d.update(extra)
|
|
100
|
+
prompt = "請選擇"
|
|
101
|
+
if options and options[0][0] == "":
|
|
102
|
+
prompt, options = options[0][1], options[1:]
|
|
88
103
|
return _field(attr, [
|
|
89
104
|
{"type": "label", "data": {"attrID": attr + "-lab", "forInput": attr},
|
|
90
105
|
"style": {"&": {"_": {"fontFamily": MONO, "fontSize": "10px",
|
|
@@ -92,15 +107,42 @@ def select(attr, label, name, options, **extra):
|
|
|
92
107
|
"color": {"token": "--mk-faint"}},
|
|
93
108
|
"_t": {"fontSize": "12px"}}},
|
|
94
109
|
"children": [{"type": "wysiwyg-text", "data": {"text": label}}]},
|
|
95
|
-
|
|
110
|
+
# 1.0.12 replaced the native <select> (`select-input`, whose options were
|
|
111
|
+
# leaves carrying a `text` property) with a buildable one, rendered as
|
|
112
|
+
# <mosaic-select>: a combobox button plus a listbox, and a hidden input
|
|
113
|
+
# that carries the value into the submission. The shape is the factory
|
|
114
|
+
# defaults (SelectElementTypeFactory), the same one the 1.0.12 data
|
|
115
|
+
# upgrade wrote over the old select on this page:
|
|
116
|
+
# select > select-toggle > (select-placeholder > text, icon chevron)
|
|
117
|
+
# > select-options > select-option > text (any children)
|
|
118
|
+
# The visible box is the TOGGLE, so the field chrome goes there; the root
|
|
119
|
+
# keeps the width and the font the options inherit. An empty-valued first
|
|
120
|
+
# option is what a native select used as its prompt - here that is the
|
|
121
|
+
# placeholder's job. The native control survives as `listbox`
|
|
122
|
+
# (multiple / size > 1), whose `listbox-option` is still a leaf with `text`.
|
|
123
|
+
{"type": "select", "data": d,
|
|
124
|
+
"style": {"&": {"_": {"width": "100%", "fontFamily": CJK, "fontSize": "14px"}}},
|
|
96
125
|
"children": [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
|
|
126
|
+
{"type": "select-toggle", "data": {}, # the root's attrID lands here as the id
|
|
127
|
+
"style": {"&": {"_": dict(FIELD_STYLE["&"]["_"], **{
|
|
128
|
+
"display": "flex", "justifyContent": "space-between",
|
|
129
|
+
"alignItems": "center", "columnGap": "10px"})},
|
|
130
|
+
"focus-visible": FIELD_STYLE["focus-visible"]},
|
|
131
|
+
"children": [
|
|
132
|
+
{"type": "select-placeholder", "data": {},
|
|
133
|
+
"children": [{"type": "wysiwyg-text", "data": {"text": prompt}}]},
|
|
134
|
+
{"type": "icon", "data": {"svg": CHEVRON}}]},
|
|
135
|
+
{"type": "select-options", "data": {"attrID": attr + "-list"},
|
|
136
|
+
"style": {"&": {"_": {"backgroundColor": {"token": "--mk-paper"},
|
|
137
|
+
"customDeclarations": "border:1px solid rgba(22,24,28,.3);"}}},
|
|
138
|
+
"children": [
|
|
139
|
+
{"type": "select-option",
|
|
140
|
+
"data": {"attrID": "%s-o%d" % (attr, i), "value": v},
|
|
141
|
+
"style": {"&": {"_": {"paddingTop": "10px", "paddingBottom": "10px",
|
|
142
|
+
"paddingLeft": "14px", "paddingRight": "14px"}}},
|
|
143
|
+
"children": [{"type": "wysiwyg-text", "data": {"text": t}}]}
|
|
144
|
+
for i, (v, t) in enumerate(options, 1)]},
|
|
145
|
+
]},
|
|
104
146
|
])
|
|
105
147
|
|
|
106
148
|
|
|
@@ -475,7 +517,7 @@ TREE = {"type": "div", "data": {"attrID": "fm-page"},
|
|
|
475
517
|
"children": [
|
|
476
518
|
HEAD,
|
|
477
519
|
band("fm-main", "ENQUIRY / 專案洽詢",
|
|
478
|
-
"fieldset › label + text-input / select
|
|
520
|
+
"fieldset › label + text-input / select › toggle + options › option / "
|
|
479
521
|
"choice-field › choice › radio-input + checkbox-input / "
|
|
480
522
|
"fileupload-input / form-error / submit-loading",
|
|
481
523
|
full_form(), bg="--mk-panel"),
|
package/tools/mo.py
CHANGED
|
@@ -652,10 +652,22 @@ def cmd_placement(a):
|
|
|
652
652
|
emit(payload, lambda: (
|
|
653
653
|
head("placement: %s" % a.name),
|
|
654
654
|
print("rule : %s" % payload["rule"]),
|
|
655
|
-
|
|
656
|
-
|
|
655
|
+
# canBeParentFor() is checked only on the editor's drop / paste path
|
|
656
|
+
# (PlacementValidatorRaw), never on a REST commit - so "none" with heal
|
|
657
|
+
# children (navbar, dropdown) means: its own children exist, and the
|
|
658
|
+
# client cannot drag anything else into it in the editor.
|
|
659
|
+
print("editor drop-in : %s" % (", ".join(payload["allowed_children"])
|
|
660
|
+
or ("any type" if payload["rule"] == "any"
|
|
661
|
+
else "refused - nothing can be dragged in"))),
|
|
657
662
|
print("heal() inserts : %s" % (", ".join(payload["default_children"])
|
|
658
663
|
or "nothing")),
|
|
664
|
+
payload["rule"] == "none" and print(
|
|
665
|
+
" (editor-only: a REST commit does not check this rule, so\n"
|
|
666
|
+
" children written over REST still render - but a client\n"
|
|
667
|
+
" cannot drag anything into it in the editor. navbar is\n"
|
|
668
|
+
" navbar > navbar-toggle + navigation and dropdown is\n"
|
|
669
|
+
" dropdown > toggle + wrapper by their factories; put\n"
|
|
670
|
+
" anything else INSIDE navigation / the wrapper)"),
|
|
659
671
|
print("named parents : %s" % (", ".join(payload["named_parents"])
|
|
660
672
|
or "none - no type asks for it by name")),
|
|
661
673
|
print("also accepted by: %d permissive containers (rule=any / deny-list)"
|
package/tools/probe_accordion.py
CHANGED
|
@@ -71,7 +71,7 @@ def fetch(url):
|
|
|
71
71
|
|
|
72
72
|
def place(client, cfg, surface, slug, post, node, label):
|
|
73
73
|
"""Build a page carrying exactly one tree, and hand back its HTML."""
|
|
74
|
-
master = build_shell(client, cfg, {"pages": [], "shell": {}}, surface)
|
|
74
|
+
master, _header, _footer = build_shell(client, cfg, {"pages": [], "shell": {}}, surface)
|
|
75
75
|
template = bind_page(client, cfg, master, slug, post)
|
|
76
76
|
inst = "templateDocumentInstance/%s/%s" % (master, template)
|
|
77
77
|
doc = unwrap(client.get(inst), "templateDocumentInstance")
|
|
@@ -176,7 +176,7 @@ def main():
|
|
|
176
176
|
if refused else "it ACCEPTED a write it documents as not allowed")
|
|
177
177
|
|
|
178
178
|
# ── 6. two instances on a real page, and the page must show both ─────────
|
|
179
|
-
master = build_shell(client, cfg, {"pages": [], "shell": {}}, surface)
|
|
179
|
+
master, _header, _footer = build_shell(client, cfg, {"pages": [], "shell": {}}, surface)
|
|
180
180
|
template = bind_page(client, cfg, master, a.slug, a.post)
|
|
181
181
|
tinst = "templateDocumentInstance/%s/%s" % (master, template)
|
|
182
182
|
tdoc = unwrap(client.get(tinst), "templateDocumentInstance")
|
|
@@ -155,7 +155,7 @@ def main():
|
|
|
155
155
|
site = {"pages": [], "shell": {}}
|
|
156
156
|
cls_of, rules_of, page_ok = {}, {}, {}
|
|
157
157
|
for host in order:
|
|
158
|
-
master = build_shell(client, cfg, site, surface)
|
|
158
|
+
master, _header, _footer = build_shell(client, cfg, site, surface)
|
|
159
159
|
template = bind_page(client, cfg, master, a.slug, a.post)
|
|
160
160
|
build_page_document(client, cfg, master, template,
|
|
161
161
|
tree_for(batches[host]), surface)
|
|
@@ -157,8 +157,8 @@ def main():
|
|
|
157
157
|
"required is set on %d of them" % sum(1 for f in real if f["req"]))
|
|
158
158
|
check("FORM/honeypot", bool(honeypot),
|
|
159
159
|
"Mosaic adds its own spam trap: %s" % honeypot)
|
|
160
|
-
# a <select> whose options have no text renders
|
|
161
|
-
# `
|
|
160
|
+
# a native <select> (1.0.12: `listbox`) whose options have no text renders blank:
|
|
161
|
+
# `listbox-option` is a LEAF and its label is the `text` PROPERTY
|
|
162
162
|
opts = p.evaluate("""(id) => [...document.querySelectorAll('#' + id + ' option')]
|
|
163
163
|
.map(o => o.textContent.trim())""", a.form)
|
|
164
164
|
if opts:
|
|
@@ -167,6 +167,61 @@ def main():
|
|
|
167
167
|
else "blank labels - `text` is a property, not a child")
|
|
168
168
|
else:
|
|
169
169
|
skip("FORM/option_labels", "no select on this form")
|
|
170
|
+
# 1.0.12's Select is not a <select>: <mosaic-select> holds a combobox
|
|
171
|
+
# button, a role=listbox of buildable options and a hidden input that
|
|
172
|
+
# carries the value. Drive it the way a visitor does.
|
|
173
|
+
sel = p.evaluate("""(id) => { const s = document.querySelector('#' + id + ' mosaic-select');
|
|
174
|
+
return s ? s.querySelector('.m-select-toggle').id : null; }""", a.form)
|
|
175
|
+
if not sel:
|
|
176
|
+
skip("FORM/select", "no custom select on this form")
|
|
177
|
+
else:
|
|
178
|
+
st = lambda: p.evaluate("""(t) => { const b = document.getElementById(t),
|
|
179
|
+
s = b.closest('mosaic-select'), l = s.querySelector('[role=listbox]'),
|
|
180
|
+
i = s.querySelector('input.m-select-input'), r = l.getBoundingClientRect();
|
|
181
|
+
return {exp: b.getAttribute('aria-expanded'), shown: r.height > 2
|
|
182
|
+
&& getComputedStyle(l).visibility !== 'hidden'
|
|
183
|
+
&& getComputedStyle(l).display !== 'none',
|
|
184
|
+
value: i.value, name: i.name, label: b.innerText.trim(),
|
|
185
|
+
opts: [...l.querySelectorAll('[role=option]')].map(o =>
|
|
186
|
+
[o.dataset.value ?? '', o.textContent.trim()])}; }""", sel)
|
|
187
|
+
closed = st()
|
|
188
|
+
# the hidden input is not what fails validation: a submit with
|
|
189
|
+
# nothing picked marks the TOGGLE aria-invalid, which is what the
|
|
190
|
+
# field's invalid state selectors key on in 1.0.12
|
|
191
|
+
p.click("#%s [type=submit]" % a.form)
|
|
192
|
+
p.wait_for_timeout(600)
|
|
193
|
+
inv = p.evaluate("(t) => document.getElementById(t).getAttribute('aria-invalid')", sel)
|
|
194
|
+
check("FORM/select_required", inv == "true",
|
|
195
|
+
"submit with nothing picked: toggle aria-invalid=%r" % inv)
|
|
196
|
+
check("FORM/select_labels", closed["opts"] and all(t for _v, t in closed["opts"]),
|
|
197
|
+
"%d options, labels are child text nodes: %s"
|
|
198
|
+
% (len(closed["opts"]), [t for _v, t in closed["opts"]][:4]))
|
|
199
|
+
p.click("#" + sel)
|
|
200
|
+
p.wait_for_timeout(400)
|
|
201
|
+
opened = st()
|
|
202
|
+
check("FORM/select_opens", opened["exp"] == "true" and opened["shown"]
|
|
203
|
+
and not closed["shown"],
|
|
204
|
+
"toggle click: aria-expanded %s -> %s, list shown %s -> %s"
|
|
205
|
+
% (closed["exp"], opened["exp"], closed["shown"], opened["shown"]))
|
|
206
|
+
want_v, want_t = closed["opts"][1]
|
|
207
|
+
p.click("#%s ~ [role=listbox] [role=option] >> nth=1" % sel)
|
|
208
|
+
p.wait_for_timeout(400)
|
|
209
|
+
picked = st()
|
|
210
|
+
check("FORM/select_picks", picked["value"] == want_v
|
|
211
|
+
and want_t in picked["label"] and picked["exp"] == "false",
|
|
212
|
+
"picked %r: input %s=%r, toggle shows %r, closed=%s"
|
|
213
|
+
% (want_t, picked["name"], picked["value"], picked["label"],
|
|
214
|
+
picked["exp"] == "false"))
|
|
215
|
+
# keyboard: open, one row down, Enter picks the next option
|
|
216
|
+
p.focus("#" + sel)
|
|
217
|
+
p.keyboard.press("ArrowDown")
|
|
218
|
+
p.keyboard.press("ArrowDown")
|
|
219
|
+
p.keyboard.press("Enter")
|
|
220
|
+
p.wait_for_timeout(400)
|
|
221
|
+
keyed = st()
|
|
222
|
+
check("FORM/select_keyboard", keyed["value"] not in ("", picked["value"])
|
|
223
|
+
and keyed["exp"] == "false",
|
|
224
|
+
"ArrowDown, ArrowDown, Enter: %r -> %r" % (picked["value"], keyed["value"]))
|
|
170
225
|
# the browser's own validation has to stop an empty required form
|
|
171
226
|
p.evaluate("(id) => document.getElementById(id).reset()", a.form)
|
|
172
227
|
invalid = p.evaluate("""(id) => [...document.getElementById(id)
|