@blackcube/aurelia-kit 1.0.0-rc6 → 1.0.0-rc8

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/README.md CHANGED
@@ -496,7 +496,13 @@ Behavior:
496
496
 
497
497
  - Listens on `Channels.Menu`: `MenuAction.Open` applies the show classes and opens the overlay, `MenuAction.Close`
498
498
  applies the hide classes and closes the overlay, `MenuAction.Toggle` does one or the other. `aria-hidden` follows.
499
- - A click on `[data-menu=close]` closes the menu; the menu closes too when the overlay closes.
499
+ - A click on `[data-menu=close]` closes the menu; the menu closes too when the overlay closes, on `Escape` and on a
500
+ click on a link of the menu (the link is followed).
501
+ - Open, the focus is trapped in the menu (`ITrapFocusService`), on `[data-menu=close]` first; once closed, it goes back
502
+ to what opened the menu (the burger).
503
+ - The page follows: `<body>` takes the classes of the menu's `data-menu-page-show` while it is open and of its
504
+ `data-menu-page-hide` once closed — `data-menu-page-show="overflow-hidden"` keeps the page from scrolling under it.
505
+ Without these attributes, the page is left as is.
500
506
  - Publishes `MenuStatus.Opening`, `Opened`, `Closing`, `Closed` on `Channels.MenuStatus`.
501
507
  - `[data-menu=toggle-button-ID]` shows or hides `[data-menu=toggle-list-ID]` (`hidden` attribute), sets the
502
508
  data-menu-show / data-menu-hide classes of its `svg[data-menu=icon]` and its `aria-expanded`. Accordion: opening a
@@ -742,6 +748,25 @@ loaded by ajaxify):
742
748
 
743
749
  When attached, the element is focused on the next frame; the browser brings it into view.
744
750
 
751
+ ### `bleet-first-error`
752
+
753
+ A form whose first field in error takes the focus when the page says « refused » (a SPA validating its form before
754
+ posting it):
755
+
756
+ ```html
757
+ <form bleet-first-error="account" submit.trigger="onSubmit($event)" novalidate>
758
+ <input aria-invalid.bind="…" …>
759
+ </form>
760
+ ```
761
+
762
+ `Channels.Form` carries `IForm` (`{ action: FormAction.FirstError, id?: string }`): the form whose `id` is given,
763
+ every form without id, focuses its first `[aria-invalid=true]` on the next frame — once the invalid marks of the fields
764
+ are rendered. A form without a field in error does nothing.
765
+
766
+ ```typescript
767
+ resolve(IEventAggregator).publish(Channels.Form, <IForm>{ action: FormAction.FirstError, id: 'account' });
768
+ ```
769
+
745
770
  ## Upload channel
746
771
 
747
772
  `Channels.Upload` carries `IUpload` (`{ action: UploadAction.Reset, id?: string }`) for the upload bridges