@fluid-topics/ft-wc-utils 1.2.67 → 1.2.69

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.
@@ -29,6 +29,7 @@ export declare class SearchPlaceConverter {
29
29
  serialize(request: EnrichedFtSearchRequest, searchPage?: string): string;
30
30
  serializeToCurrentPageIfPossible(request: EnrichedFtSearchRequest, searchPage?: string): string;
31
31
  toURLSearchParams(request: EnrichedFtSearchRequest, omitContentLocaleIfDefault?: boolean): string;
32
+ private encodeQueryString;
32
33
  parse(url: string): EnrichedFtSearchRequest;
33
34
  fromURLSearchParams(strParams: string): EnrichedFtSearchRequest;
34
35
  private parseCompatFilters;
@@ -112,8 +112,19 @@ export class SearchPlaceConverter {
112
112
  for (let key in otherQueryParams) {
113
113
  params.append(key, otherQueryParams[key]);
114
114
  }
115
+ // Use encodeURIComponent instead of URLSearchParams.toString() to encode the result
116
+ // encodeURIComponent encodes everything but characters - _ . ! ~ * ' ( )
117
+ // To be compliant with the expected "application/x-www-form-urlencoded" we must also replace spaces by "+" (instead of %20)
118
+ const result = new Array();
119
+ params.forEach((value, key) => {
120
+ result.push(this.encodeQueryString(key) + "=" + this.encodeQueryString(value));
121
+ });
115
122
  // GWT needs the query string to be encoded twice 🙄
116
- return encodeURI(params.toString()).replace(/#/g, "%23");
123
+ return encodeURI(result.join("&")).replace(/#/g, "%23");
124
+ }
125
+ encodeQueryString(value) {
126
+ return encodeURIComponent(value)
127
+ .replace(/%20/g, "+");
117
128
  }
118
129
  parse(url) {
119
130
  var _a;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Invisible Content Just for Screen Reader Users
3
+ * See more:
4
+ * - https://webaim.org/techniques/css/invisiblecontent/
5
+ * - https://webaim.org/techniques/skipnav/
6
+ *
7
+ * The following are the recommended styles for visually hiding content
8
+ * that will be read by a screen reader.
9
+ *
10
+ * The .sr-only CSS class should then be referenced in the tag of the
11
+ * element being hidden, as shown:
12
+ * <div class="sr-only">This text is hidden.</div>
13
+ *
14
+ * Sighted users will not see the hidden content at all—it will be hidden well
15
+ * to the left of the visible browser window. Because it is still part of the
16
+ * page content, screen readers will read it.
17
+ *
18
+ * Skip navigation links are useful to give screen reader and keyboard users the
19
+ * capability of navigating directly to the main content.
20
+ *
21
+ * To address the concerns that a visible skip link can be intrusive, but
22
+ * still create a skip link that is useful for sighted keyboard users, we
23
+ * recommend creating a link that is hidden until to the user navigates to it
24
+ * with a keyboard.
25
+ *
26
+ * This technique uses two style definitions—one to visually hide the link, and
27
+ * another using the a:focus pseudo-class to visually reveal the link while it has focus.
28
+ *
29
+ * These styles should then be applied to the "skip" link:
30
+ * <div id="skip"><a href="#content">Skip to Main Content</a></div>
31
+ */
32
+ export declare const screenReaderStyles: import("lit").CSSResult;
@@ -0,0 +1,57 @@
1
+ import { css } from "lit";
2
+ /**
3
+ * Invisible Content Just for Screen Reader Users
4
+ * See more:
5
+ * - https://webaim.org/techniques/css/invisiblecontent/
6
+ * - https://webaim.org/techniques/skipnav/
7
+ *
8
+ * The following are the recommended styles for visually hiding content
9
+ * that will be read by a screen reader.
10
+ *
11
+ * The .sr-only CSS class should then be referenced in the tag of the
12
+ * element being hidden, as shown:
13
+ * <div class="sr-only">This text is hidden.</div>
14
+ *
15
+ * Sighted users will not see the hidden content at all—it will be hidden well
16
+ * to the left of the visible browser window. Because it is still part of the
17
+ * page content, screen readers will read it.
18
+ *
19
+ * Skip navigation links are useful to give screen reader and keyboard users the
20
+ * capability of navigating directly to the main content.
21
+ *
22
+ * To address the concerns that a visible skip link can be intrusive, but
23
+ * still create a skip link that is useful for sighted keyboard users, we
24
+ * recommend creating a link that is hidden until to the user navigates to it
25
+ * with a keyboard.
26
+ *
27
+ * This technique uses two style definitions—one to visually hide the link, and
28
+ * another using the a:focus pseudo-class to visually reveal the link while it has focus.
29
+ *
30
+ * These styles should then be applied to the "skip" link:
31
+ * <div id="skip"><a href="#content">Skip to Main Content</a></div>
32
+ */
33
+ export const screenReaderStyles = css `
34
+ .sr-only {
35
+ position:absolute;
36
+ left:-10000px;
37
+ top:auto;
38
+ width:1px;
39
+ height:1px;
40
+ overflow:hidden;
41
+ }
42
+
43
+ #skip a {
44
+ position:absolute;
45
+ left:-10000px;
46
+ top:auto;
47
+ width:1px;
48
+ height:1px;
49
+ overflow:hidden;
50
+ }
51
+
52
+ #skip a:focus {
53
+ position:static;
54
+ width:auto;
55
+ height:auto;
56
+ }
57
+ `;