primer_view_components 0.13.1 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -151,13 +151,15 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
151
151
  }
152
152
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_activateItem).call(this, event, item);
153
153
  __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleItemActivated).call(this, event, item);
154
- // Pressing the space key on a button will cause the page to scroll unless preventDefault()
155
- // is called. Unfortunately, calling preventDefault() will also skip form submission. The
156
- // code below therefore only calls preventDefault() if the button submits a form and the
157
- // button is being activated by the space key.
158
- if (item.getAttribute('type') === 'submit' && __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isKeyboardActivationViaSpace).call(this, event)) {
154
+ // Pressing the space key on a button or link will cause the page to scroll unless preventDefault()
155
+ // is called. While calling preventDefault() appears to have no effect on link navigation, it skips
156
+ // form submission. The code below therefore only calls preventDefault() if the button has been
157
+ // activated by the space key, and manually submits the form if the button is a submit button.
158
+ if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isKeyboardActivationViaSpace).call(this, event)) {
159
159
  event.preventDefault();
160
- (_b = item.closest('form')) === null || _b === void 0 ? void 0 : _b.submit();
160
+ if (item.getAttribute('type') === 'submit') {
161
+ (_b = item.closest('form')) === null || _b === void 0 ? void 0 : _b.submit();
162
+ }
161
163
  }
162
164
  return;
163
165
  }
@@ -216,13 +216,16 @@ export class ActionMenuElement extends HTMLElement {
216
216
  this.#activateItem(event, item)
217
217
  this.#handleItemActivated(event, item)
218
218
 
219
- // Pressing the space key on a button will cause the page to scroll unless preventDefault()
220
- // is called. Unfortunately, calling preventDefault() will also skip form submission. The
221
- // code below therefore only calls preventDefault() if the button submits a form and the
222
- // button is being activated by the space key.
223
- if (item.getAttribute('type') === 'submit' && this.#isKeyboardActivationViaSpace(event)) {
219
+ // Pressing the space key on a button or link will cause the page to scroll unless preventDefault()
220
+ // is called. While calling preventDefault() appears to have no effect on link navigation, it skips
221
+ // form submission. The code below therefore only calls preventDefault() if the button has been
222
+ // activated by the space key, and manually submits the form if the button is a submit button.
223
+ if (this.#isKeyboardActivationViaSpace(event)) {
224
224
  event.preventDefault()
225
- item.closest('form')?.submit()
225
+
226
+ if (item.getAttribute('type') === 'submit') {
227
+ item.closest('form')?.submit()
228
+ }
226
229
  }
227
230
 
228
231
  return
@@ -1 +1 @@
1
- anchored-position[popover]{background:none;border-width:0;inset:auto;min-width:192px;overflow:visible;padding:0;position:absolute}.Overlay{display:flex}anchored-position[popover]:not(.\:popover-open){display:none}anchored-position.not-anchored::-webkit-backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}anchored-position.not-anchored::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}@supports selector(:popover-open){anchored-position[popover]:not(.\:popover-open){display:revert}}
1
+ anchored-position[popover]{background:none;border-width:0;min-width:192px;overflow:visible;padding:0;position:absolute}.Overlay{display:flex}anchored-position.not-anchored::-webkit-backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}anchored-position.not-anchored::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}
@@ -3,7 +3,6 @@
3
3
  "selectors": [
4
4
  "anchored-position[popover]",
5
5
  ".Overlay",
6
- "anchored-position[popover]:not(.\\:popover-open)",
7
6
  "anchored-position.not-anchored::-webkit-backdrop",
8
7
  "anchored-position.not-anchored::backdrop"
9
8
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["overlay.pcss"],"names":[],"mappings":"AAAA,2BAOE,eAAgB,CANhB,cAAe,CAIf,UAAW,CADX,eAAgB,CAEhB,gBAAiB,CAJjB,SAAU,CACV,iBAKF,CAEA,SACE,YACF,CAEA,gDACE,YACF,CAEA,iDACE,2EACF,CAFA,yCACE,2EACF,CAGA,kCACE,gDACE,cACF,CACF","file":"overlay.css","sourcesContent":["anchored-position[popover] {\n border-width: 0;\n padding: 0;\n position: absolute;\n min-width: 192px;\n inset: auto;\n overflow: visible;\n background: none;\n}\n\n.Overlay {\n display: flex;\n}\n\nanchored-position[popover]:not(.\\:popover-open) {\n display: none;\n}\n\nanchored-position.not-anchored::backdrop {\n background-color: var(--overlay-backdrop-bgColor, var(--color-neutral-muted));\n}\n\n/* This reverts the declaration above for native popover, where `:popover-open` is supported */\n@supports selector(:popover-open) {\n anchored-position[popover]:not(.\\:popover-open) {\n display: revert;\n }\n}\n"]}
1
+ {"version":3,"sources":["overlay.pcss"],"names":[],"mappings":"AAAA,2BAME,eAAgB,CALhB,cAAe,CAGf,eAAgB,CAChB,gBAAiB,CAHjB,SAAU,CACV,iBAIF,CAEA,SACE,YACF,CAEA,iDACE,2EACF,CAFA,yCACE,2EACF","file":"overlay.css","sourcesContent":["anchored-position[popover] {\n border-width: 0;\n padding: 0;\n position: absolute;\n min-width: 192px;\n overflow: visible;\n background: none;\n}\n\n.Overlay {\n display: flex;\n}\n\nanchored-position.not-anchored::backdrop {\n background-color: var(--overlay-backdrop-bgColor, var(--color-neutral-muted));\n}\n"]}
@@ -3,7 +3,6 @@ anchored-position[popover] {
3
3
  padding: 0;
4
4
  position: absolute;
5
5
  min-width: 192px;
6
- inset: auto;
7
6
  overflow: visible;
8
7
  background: none;
9
8
  }
@@ -12,17 +11,6 @@ anchored-position[popover] {
12
11
  display: flex;
13
12
  }
14
13
 
15
- anchored-position[popover]:not(.\:popover-open) {
16
- display: none;
17
- }
18
-
19
14
  anchored-position.not-anchored::backdrop {
20
15
  background-color: var(--overlay-backdrop-bgColor, var(--color-neutral-muted));
21
16
  }
22
-
23
- /* This reverts the declaration above for native popover, where `:popover-open` is supported */
24
- @supports selector(:popover-open) {
25
- anchored-position[popover]:not(.\:popover-open) {
26
- display: revert;
27
- }
28
- }
@@ -1,5 +1,4 @@
1
1
  import '@github/include-fragment-element';
2
- import '@oddbird/popover-polyfill';
3
2
  import './alpha/action_bar_element';
4
3
  import './alpha/dropdown';
5
4
  import './anchored_position';
@@ -1,5 +1,4 @@
1
1
  import '@github/include-fragment-element';
2
- import '@oddbird/popover-polyfill';
3
2
  import './alpha/action_bar_element';
4
3
  import './alpha/dropdown';
5
4
  import './anchored_position';
@@ -1,5 +1,3 @@
1
- @import "@oddbird/popover-polyfill/dist/popover.css";
2
-
3
1
  /* CSS component styles here */
4
2
 
5
3
  /* alpha */
@@ -1,5 +1,4 @@
1
1
  import '@github/include-fragment-element'
2
- import '@oddbird/popover-polyfill'
3
2
  import './alpha/action_bar_element'
4
3
  import './alpha/dropdown'
5
4
  import './anchored_position'
@@ -70,10 +70,15 @@ module Primer
70
70
  render_erb_ignoring_markdown_code_fences(docs.base_docstring)
71
71
  end
72
72
 
73
+ accessibility_docs =
74
+ if (accessibility_tag_text = docs.tags(:accessibility)&.first&.text)
75
+ render_erb_ignoring_markdown_code_fences(accessibility_tag_text)
76
+ end
77
+
73
78
  memo[component] = {
74
79
  "fully_qualified_name" => component.name,
75
80
  "description" => description,
76
- "accessibility_docs" => docs.tags(:accessibility)&.first&.text,
81
+ "accessibility_docs" => accessibility_docs,
77
82
  "is_form_component" => docs.manifest_entry.form_component?,
78
83
  "is_published" => docs.manifest_entry.published?,
79
84
  "requires_js" => docs.manifest_entry.requires_js?,
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 13
9
- PATCH = 1
9
+ PATCH = 2
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -7062,7 +7062,7 @@
7062
7062
  {
7063
7063
  "fully_qualified_name": "Primer::Alpha::TabNav",
7064
7064
  "description": "Use `TabNav` to style navigation with a tab-based selected state, typically used for navigation placed at the top of the page.\nFor panel navigation, use {{#link_to_component}}Primer::Alpha::TabPanels{{/link_to_component}} instead.",
7065
- "accessibility_docs": "- By default, `TabNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See <%= link_to_component(Primer::Alpha::Navigation::Tab) %> for additional\n accessibility considerations.",
7065
+ "accessibility_docs": "- By default, `TabNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See {{#link_to_component}}Primer::Alpha::Navigation::Tab{{/link_to_component}} for additional\n accessibility considerations.",
7066
7066
  "is_form_component": false,
7067
7067
  "is_published": true,
7068
7068
  "requires_js": false,
@@ -8461,7 +8461,7 @@
8461
8461
  {
8462
8462
  "fully_qualified_name": "Primer::Alpha::UnderlineNav",
8463
8463
  "description": "Use `UnderlineNav` to style navigation links with a minimal\nunderlined selected state, typically placed at the top\nof the page.\n\nFor panel navigation, use {{#link_to_component}}Primer::Alpha::UnderlinePanels{{/link_to_component}} instead.",
8464
- "accessibility_docs": "- By default, `UnderlineNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See <%= link_to_component(Primer::Alpha::Navigation::Tab) %> for additional\n accessibility considerations.",
8464
+ "accessibility_docs": "- By default, `UnderlineNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See {{#link_to_component}}Primer::Alpha::Navigation::Tab{{/link_to_component}} for additional\n accessibility considerations.",
8465
8465
  "is_form_component": false,
8466
8466
  "is_published": true,
8467
8467
  "requires_js": false,
@@ -10189,7 +10189,7 @@
10189
10189
  {
10190
10190
  "fully_qualified_name": "Primer::Beta::BorderBox::Header",
10191
10191
  "description": "`BorderBox::Header` is used inside `BorderBox` to render its header slot.",
10192
- "accessibility_docs": "When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context. <%= link_to_heading_practices %>",
10192
+ "accessibility_docs": "When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context. [Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
10193
10193
  "is_form_component": false,
10194
10194
  "is_published": true,
10195
10195
  "requires_js": false,
@@ -11589,7 +11589,7 @@
11589
11589
  {
11590
11590
  "fully_qualified_name": "Primer::Beta::Heading",
11591
11591
  "description": "`Heading` should be used to communicate page organization and hierarchy.\n\n- Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is appropriate for the page context.\n- Use `Heading` as the title of a section or sub section.\n- Do not use `Heading` for styling alone. For simply styling text, consider using {{#link_to_component}}Primer::Beta::Text{{/link_to_component}} with relevant {{link_to_typography_docs}}\n such as `font_size` and `font_weight`.\n- Do not jump heading levels. For instance, do not follow a `<h1>` with an `<h3>`. Heading levels should increase by one in ascending order.",
11592
- "accessibility_docs": "While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.\nWhen text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be\nconsistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)\n\nHeadings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.\n<%= link_to_heading_practices %>",
11592
+ "accessibility_docs": "While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.\nWhen text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be\nconsistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)\n\nHeadings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
11593
11593
  "is_form_component": false,
11594
11594
  "is_published": true,
11595
11595
  "requires_js": false,
@@ -13751,7 +13751,7 @@
13751
13751
  {
13752
13752
  "fully_qualified_name": "Primer::Beta::Subhead",
13753
13753
  "description": "Use `Subhead` as the start of a section. The `:heading` slot will render an `<h2>` font-sized text.\n\n- Optionally set the `:description` slot to render a short description and the `:actions` slot for a related action.\n- Use a succinct, one-line description for the `:description` slot. For longer descriptions, omit the description slot and render a paragraph below the `Subhead`.\n- Use the actions slot to render a related action to the right of the heading. Use {{#link_to_component}}Primer::ButtonComponent{{/link_to_component}} or {{#link_to_component}}Primer::Beta::Link{{/link_to_component}}.",
13754
- "accessibility_docs": "The `:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.\n<%= link_to_heading_practices %>",
13754
+ "accessibility_docs": "The `:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
13755
13755
  "is_form_component": false,
13756
13756
  "is_published": true,
13757
13757
  "requires_js": false,
@@ -14288,7 +14288,7 @@
14288
14288
  {
14289
14289
  "fully_qualified_name": "Primer::BlankslateComponent",
14290
14290
  "description": "Use `Blankslate` when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.",
14291
- "accessibility_docs": "`Blankslate` renders an `<h3>` element for the title by default. Update the heading level based on what is appropriate for your page hierarchy by setting `title_tag`.\n<%= link_to_heading_practices %>",
14291
+ "accessibility_docs": "`Blankslate` renders an `<h3>` element for the title by default. Update the heading level based on what is appropriate for your page hierarchy by setting `title_tag`.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
14292
14292
  "is_form_component": false,
14293
14293
  "is_published": true,
14294
14294
  "requires_js": false,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview