@myst-theme/site 1.2.0 → 1.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/site",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -25,11 +25,11 @@
25
25
  "dependencies": {
26
26
  "@headlessui/react": "^1.7.15",
27
27
  "@heroicons/react": "^2.0.18",
28
- "@myst-theme/common": "^1.2.0",
29
- "@myst-theme/diagrams": "^1.2.0",
30
- "@myst-theme/frontmatter": "^1.2.0",
31
- "@myst-theme/providers": "^1.2.0",
32
- "@myst-theme/search": "^1.2.0",
28
+ "@myst-theme/common": "^1.2.2",
29
+ "@myst-theme/diagrams": "^1.2.2",
30
+ "@myst-theme/frontmatter": "^1.2.2",
31
+ "@myst-theme/providers": "^1.2.2",
32
+ "@myst-theme/search": "^1.2.2",
33
33
  "@radix-ui/react-collapsible": "^1.0.3",
34
34
  "@radix-ui/react-dialog": "^1.0.3",
35
35
  "@radix-ui/react-visually-hidden": "^1.1.0",
@@ -37,9 +37,9 @@
37
37
  "lodash.throttle": "^4.1.1",
38
38
  "myst-common": "^1.8.1",
39
39
  "myst-config": "^1.7.9",
40
- "myst-demo": "^1.2.0",
40
+ "myst-demo": "^1.2.2",
41
41
  "myst-spec-ext": "^1.8.1",
42
- "myst-to-react": "^1.2.0",
42
+ "myst-to-react": "^1.2.2",
43
43
  "nbtx": "^0.2.3",
44
44
  "node-cache": "^5.1.2",
45
45
  "node-fetch": "^2.6.11",
@@ -245,13 +245,13 @@ function SearchResultItem({
245
245
  />
246
246
  );
247
247
 
248
- // Render the subtitle i.e. file name
249
- let subtitleRenderer;
248
+ // Render the context i.e. file name
249
+ let contextRenderer;
250
250
  if (result.type === 'lvl1') {
251
- subtitleRenderer = undefined;
251
+ contextRenderer = undefined;
252
252
  } else {
253
- const subtitle = result.hierarchy.lvl1!;
254
- subtitleRenderer = <MarkedText text={subtitle} matches={matches} className="text-xs" />;
253
+ const contextName = result.hierarchy.lvl1!;
254
+ contextRenderer = <MarkedText text={contextName} matches={matches} className="text-xs" />;
255
255
  }
256
256
 
257
257
  const enterIconRenderer = (
@@ -268,8 +268,8 @@ function SearchResultItem({
268
268
  <div className="flex flex-row h-11">
269
269
  {iconRenderer}
270
270
  <div className="flex flex-col justify-center truncate grow">
271
+ {contextRenderer}
271
272
  {titleRenderer}
272
- {subtitleRenderer}
273
273
  </div>
274
274
  {enterIconRenderer}
275
275
  </div>
@@ -527,6 +527,7 @@ function SearchForm({
527
527
  id={searchInputID}
528
528
  aria-labelledby={searchLabelID}
529
529
  aria-controls={searchListID}
530
+ aria-expanded={!!searchResults}
530
531
  placeholder="Search"
531
532
  type="search"
532
533
  required
@@ -557,9 +558,15 @@ const SearchPlaceholderButton = forwardRef<
557
558
  HTMLButtonElement,
558
559
  SearchPlaceholderButtonProps & Dialog.DialogTriggerProps
559
560
  >(({ className, disabled, ...props }, ref) => {
561
+ // Here we remove aria-controls from props so we can *decide* whether to insert it later
562
+ // This is because radix has a bug where it'll try pointing to a non-existent element
563
+ // if the dialog isn't open, so that's the logic we test below.
564
+ // ref: https://github.com/radix-ui/primitives/issues/3560
565
+ const { 'aria-controls': ariaControls, ...restProps } = props;
560
566
  return (
561
567
  <button
562
- {...props}
568
+ {...restProps}
569
+ aria-controls={restProps['aria-expanded'] ? ariaControls : undefined}
563
570
  className={classNames(
564
571
  'myst-search-bar',
565
572
  className,