Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard nav to search; improve search productArea suggestions #174

Merged
merged 165 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from 160 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
605fd57
Add product dropdown to draft template
jeffdaley Mar 28, 2023
8f31e59
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Mar 29, 2023
3166712
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Mar 30, 2023
fde652e
Add tests
jeffdaley Mar 30, 2023
8e0dd4d
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Apr 7, 2023
0c51886
Start of custom popover
jeffdaley Apr 7, 2023
a859c63
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Apr 11, 2023
849b965
Start generic popover component
jeffdaley Apr 11, 2023
7d95f39
Organization
jeffdaley Apr 11, 2023
86e5b2c
Maybe In Element
jeffdaley Apr 11, 2023
7b9a5ea
More API development
jeffdaley Apr 11, 2023
3f09a07
Fix type errors
jeffdaley Apr 11, 2023
cb2d280
Additional component work
jeffdaley Apr 11, 2023
88ac4bc
Progress
jeffdaley Apr 12, 2023
8e78bac
Start of keyboard nav hookup
jeffdaley Apr 12, 2023
beb53e1
UX improvements, experiments
jeffdaley Apr 12, 2023
46d6571
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Apr 12, 2023
349565b
WIP - IDs
jeffdaley Apr 12, 2023
2e236d1
Minor refactor and cleanup
jeffdaley Apr 12, 2023
1e325d0
Update list.hbs
jeffdaley Apr 13, 2023
276e8cb
Reorganize FloatingUI components
jeffdaley Apr 13, 2023
c2d6405
Update content.ts
jeffdaley Apr 13, 2023
4be0635
Improve loading strategy
jeffdaley Apr 17, 2023
34603f4
Add `ember-element-helper`
jeffdaley Apr 19, 2023
9a9dc7e
Refactor dropdown list container
jeffdaley Apr 19, 2023
b3b47a1
Template tweaks
jeffdaley Apr 19, 2023
788c5db
Template and CSS cleanup
jeffdaley Apr 19, 2023
d7c0bbd
CSS cleanup
jeffdaley Apr 19, 2023
846b445
API tweak
jeffdaley Apr 19, 2023
e834cdd
Rename files
jeffdaley Apr 19, 2023
f80e982
Rearrange files
jeffdaley Apr 19, 2023
3ab153e
Update index.hbs
jeffdaley Apr 20, 2023
440374f
Yield items to main component
jeffdaley Apr 20, 2023
0148087
Port facetDropdown to new Listbox
jeffdaley Apr 20, 2023
8d8e3cc
Yielded components; general refactors
jeffdaley Apr 20, 2023
8dde845
Toggle components
jeffdaley Apr 20, 2023
5648653
Improved saving state
jeffdaley Apr 20, 2023
f980edc
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Apr 21, 2023
e94c00d
Class rearranging
jeffdaley Apr 21, 2023
b61b709
Add sortBy component
jeffdaley Apr 21, 2023
29928d0
Remove unused files
jeffdaley Apr 21, 2023
7faa805
Update syntax
jeffdaley Apr 21, 2023
2628d73
Improve tests passing
jeffdaley Apr 21, 2023
341bd21
Update tests
jeffdaley Apr 21, 2023
fdfc880
FloatingUI API tweaks
jeffdaley Apr 21, 2023
51f99ac
Tweak FUI
jeffdaley Apr 21, 2023
d5b5364
Delete playground.hbs
jeffdaley Apr 21, 2023
6f16755
Update config.ts
jeffdaley Apr 21, 2023
af7adf0
Rename/reorg
jeffdaley Apr 21, 2023
b157123
Remove references to `f.content`
jeffdaley Apr 21, 2023
91c9d88
Add comments to index
jeffdaley Apr 21, 2023
6dd20c6
Additional classes and documentation
jeffdaley Apr 21, 2023
7a86f94
Clean up FacetDropdown
jeffdaley Apr 24, 2023
36e4031
Move FacetDropdown tests to DropdownListIndex
jeffdaley Apr 24, 2023
618a4bb
Add aria test
jeffdaley Apr 24, 2023
68b9aa8
Test Keyboard navigation
jeffdaley Apr 24, 2023
0ab1580
Test Enter key
jeffdaley Apr 24, 2023
1068f0b
Add keyboard tests
jeffdaley Apr 24, 2023
40193cf
ToggleButton test
jeffdaley Apr 24, 2023
4b14e21
LinkTo, CheckableItem tests
jeffdaley Apr 24, 2023
811ef93
CSS tweaks
jeffdaley Apr 24, 2023
913eae8
Update list.scss
jeffdaley Apr 25, 2023
8a07922
Add ToggleSelect and update NewDocForm
jeffdaley Apr 25, 2023
81c54b3
Improvements around productAbbreviations
jeffdaley Apr 25, 2023
7987cd6
Update checkable-item-test.ts
jeffdaley Apr 25, 2023
d274798
Fix scrolling issue
jeffdaley Apr 25, 2023
47f550a
Update index.ts
jeffdaley Apr 25, 2023
2f58471
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Apr 26, 2023
79bae0e
Stop propigation on the DropdownList
jeffdaley Apr 26, 2023
71a815d
Add product abbreviation to dropdown
jeffdaley Apr 26, 2023
78be77e
Tweaked ProductDropdown
jeffdaley Apr 26, 2023
fdddbf1
Improve ProductSelect dropdown
jeffdaley Apr 26, 2023
925f089
Replace ToggleSelect
jeffdaley Apr 26, 2023
eebdcc7
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Apr 28, 2023
a527e0c
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 2, 2023
3be7b84
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 2, 2023
3e38f36
Delete toggle-select.hbs
jeffdaley May 2, 2023
3624e7c
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 2, 2023
c574acb
Clean up FloatDown API
jeffdaley May 2, 2023
e6f9a45
Replace FacetDropdowns
jeffdaley May 2, 2023
2c3c623
Merge branch 'main' into jeffdaley/replace-facet-dropdown-list
jeffdaley May 2, 2023
e7b75c3
Improve styling
jeffdaley May 2, 2023
485e2cb
Basic search keyboardFunctions done
jeffdaley May 13, 2023
aa1e98e
Improved semantics of header
jeffdaley May 15, 2023
60f36c0
Improve model/query args; add Glint boilerplate
jeffdaley May 15, 2023
f6114d1
Contextual "Best matches" header
jeffdaley May 15, 2023
aeef9b6
Improve popover styles
jeffdaley May 15, 2023
7caa6ee
UX Improvements
jeffdaley May 16, 2023
9d52041
Update product/area link
jeffdaley May 16, 2023
a35a1b7
Add support for offset
jeffdaley May 16, 2023
99bed68
Removed commented-out code
jeffdaley May 16, 2023
b9348c9
Add and test LinkTo helpers
jeffdaley May 16, 2023
86f624b
Tweak types, Glint boilerplate
jeffdaley May 16, 2023
586bd2b
Merge branch 'jeffdaley/link-to-helpers' into jeffdaley/search-keyboa…
jeffdaley May 16, 2023
aaa119b
Merge branch 'jeffdaley/add-offset-to-floating-ui' into jeffdaley/sea…
jeffdaley May 16, 2023
f5b8ecf
Glint tweaks
jeffdaley May 16, 2023
942701f
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 16, 2023
c59cd16
Merge branch 'jeffdaley/link-to-helpers' into jeffdaley/change-produc…
jeffdaley May 16, 2023
80690bf
Merge branch 'jeffdaley/add-offset-to-floating-ui' into jeffdaley/cha…
jeffdaley May 16, 2023
9ac5ca2
Merge branch 'jeffdaley/replace-facet-dropdown-list' into jeffdaley/c…
jeffdaley May 16, 2023
671d1ec
Improve saving state
jeffdaley May 17, 2023
1f0392d
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 17, 2023
219fdfe
Cleanup
jeffdaley May 17, 2023
77986b6
Glint-related updates
jeffdaley May 17, 2023
e540d8c
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley May 17, 2023
8c79bd0
Glint types, todo test
jeffdaley May 17, 2023
4f71d00
Start of badgeDropdownList tests
jeffdaley May 17, 2023
0699c82
Move tests to acceptance
jeffdaley May 30, 2023
2685308
Simplify glint-nochecks
jeffdaley May 30, 2023
a254919
Fix broken tests
jeffdaley May 30, 2023
db5eaa9
Remove old code
jeffdaley May 30, 2023
bfc74d5
Test fixes and improvements
jeffdaley May 30, 2023
6d0a401
File renames
jeffdaley May 30, 2023
706d637
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 30, 2023
bbdb6fd
Update docNumber function
jeffdaley May 30, 2023
57516d1
Update badge-dropdown-list-test.ts
jeffdaley May 30, 2023
c00bc4e
Update checkable-item.hbs
jeffdaley May 30, 2023
774d8c7
Update item.ts
jeffdaley May 30, 2023
675df6d
BadgeDropdownList component
jeffdaley May 30, 2023
9699c59
BadgeDropdownList component
jeffdaley May 30, 2023
a8db64b
Add custom-item test
jeffdaley May 30, 2023
556859d
Merge branch 'jeffdaley/badge-dropdown-list' of https://github.com/ha…
jeffdaley May 30, 2023
506b825
Remove unnecessary comment
jeffdaley May 30, 2023
df1e9a9
Update list-item.scss
jeffdaley May 30, 2023
ffe0d6e
Resolve merge conflict
jeffdaley May 30, 2023
779f296
Merge branch 'jeffdaley/badge-dropdown-list' into jeffdaley/change-pr…
jeffdaley May 30, 2023
e84f454
ProductSelect component
jeffdaley May 30, 2023
0c95dc8
Add list item tests
jeffdaley May 30, 2023
20aada4
Tests, styles, cleanup
jeffdaley May 31, 2023
bb00756
Add onChange test
jeffdaley May 31, 2023
9689926
Merge branch 'jeffdaley/product-select' into jeffdaley/change-product…
jeffdaley May 31, 2023
cfffbed
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 31, 2023
024be6f
Merge branch 'main' into jeffdaley/product-select
jeffdaley May 31, 2023
78b5a54
Pass @icon into component
jeffdaley May 31, 2023
75a6f50
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley May 31, 2023
b1912d9
Remove unused property
jeffdaley May 31, 2023
4691a8d
Remove unused property
jeffdaley May 31, 2023
73029bb
Revert unintended change
jeffdaley May 31, 2023
064a2cf
Merge branch 'jeffdaley/product-select' into jeffdaley/change-product…
jeffdaley May 31, 2023
a847aad
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley May 31, 2023
d24e3b8
Padding tweak; Prettier
jeffdaley May 31, 2023
f31e5dd
Merge branch 'jeffdaley/product-select' into jeffdaley/change-product…
jeffdaley May 31, 2023
307b46f
Revert trivial change
jeffdaley May 31, 2023
9894c03
Start of working tests
jeffdaley May 31, 2023
f1fb580
More tests
jeffdaley May 31, 2023
b5d1d76
Merge branch 'main' into jeffdaley/change-product-area
jeffdaley Jun 2, 2023
fea6e55
Fix failing tests
jeffdaley Jun 2, 2023
3c539b3
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley Jun 2, 2023
d73b52d
CSS tweaks
jeffdaley Jun 2, 2023
b360b9e
Cleanup
jeffdaley Jun 2, 2023
f72feae
Cleanup and height tweaks
jeffdaley Jun 2, 2023
0ae754f
Class cleanup
jeffdaley Jun 2, 2023
81ff274
Merge branch 'jeffdaley/change-product-area' into jeffdaley/search-ke…
jeffdaley Jun 2, 2023
c07a951
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley Jun 2, 2023
c6b689e
Update factory type
jeffdaley Jun 5, 2023
99b175d
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley Jun 7, 2023
9625b2e
Cleanup, documentation and UX improvements
jeffdaley Jun 7, 2023
f277a0a
Improve shouldRenderOut documentation
jeffdaley Jun 7, 2023
0956f27
Fix broken tests
jeffdaley Jun 7, 2023
c8b818e
Add itemShouldRenderOut test
jeffdaley Jun 7, 2023
0a11e81
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley Jun 9, 2023
11d98b7
Remove need for separate index
jeffdaley Jun 9, 2023
82c7283
Update Mirage responses and search tests
jeffdaley Jun 9, 2023
e2093d8
Merge branch 'main' into jeffdaley/search-keyboard-nav
jeffdaley Jun 9, 2023
5762983
Make product facet searchable
jeffdaley Jun 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/app/components/floating-u-i/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";

interface FloatingUIComponentSignature {
Element: HTMLDivElement;
Args: {
renderOut?: boolean;
placement?: Placement;
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/header/nav.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</LinkTo>
</div>

<Header::Search data-test-nav-search-bar class="search-bar" />
<Header::Search class="global-search" />

<div class="user-buttons">
<Hds::Button
Expand Down
190 changes: 111 additions & 79 deletions web/app/components/header/search.hbs
Original file line number Diff line number Diff line change
@@ -1,91 +1,123 @@
{{! @glint-nocheck: not typesafe yet }}
{{on-document "keydown" this.onKeydown}}
{{on-document "keydown" this.maybeFocusInput}}

<div ...attributes>
<form class="w-full" {{on "submit" this.goToResults}}>
<BasicDropdown @renderInPlace={{true}} @horizontalPosition="right" as |dd|>
<Hds::Form::TextInput::Base
@type="search"
@value={{this.query}}
name="query"
size="25"
placeholder="Find a document..."
aria-label="Find a document..."
data-ebd-id="{{dd.uniqueId}}-trigger"
{{on "focusin" dd.actions.open}}
{{on "mousedown" (fn this.maybeCloseDropdown dd)}}
{{on "input" (perform this.search dd)}}
{{did-insert this.registerInput}}
/>
{{#unless this.query}}
<span
class="absolute right-[13px] top-1/2 -translate-y-1/2 text-color-foreground-faint"
>
⌘K
</span>
{{/unless}}
{{#if this.query}}
<dd.Content class="hds-dropdown__content search-dropdown">
{{#if this.bestMatches}}
<div
class="flex flex-col border-0 border-b hds-border-primary pb-1"
>
<LinkTo
@route="authenticated.results"
@query={{hash q=this.query page=1}}
class="hds-dropdown-list-item--variant-interactive"
>
<FlightIcon @name="search" class="mr-1.5" />
<span>View all results for "{{this.query}}"</span>
</LinkTo>
</div>
<div
class="flex flex-col border-0 border-b hds-border-primary py-1"
>
{{#let (get (get this.bestMatches 0) "product") as |product|}}
<LinkTo
<form class="w-full relative" {{on "submit" this.viewAllResults}}>
<X::DropdownList
@items={{this.itemsToShow}}
@offset={{hash mainAxis=0 crossAxis=3}}
@placement="bottom-end"
class="search-popover
{{unless this.bestMatchesHeaderIsShown 'no-best-matches'}}"
>
<:anchor as |dd|>
<Hds::Form::TextInput::Base
data-test-global-search-input
{{did-insert dd.registerAnchor}}
{{did-insert this.registerInput}}
{{on "input" (perform this.search dd)}}
{{on "mousedown" (fn this.maybeCloseDropdown dd)}}
{{on "keydown" (fn this.maybeSubmitForm dd)}}
{{on "focusin" (fn this.maybeOpenDropdown dd)}}
@type="search"
@value={{this.query}}
name="query"
size="25"
placeholder="Find a document..."
aria-label="Find a document..."
aria-controls={{dd.ariaControls}}
aria-expanded={{dd.contentIsShown}}
aria-haspopup="listbox"
/>
jeffdaley marked this conversation as resolved.
Show resolved Hide resolved
{{#unless this.query}}
<span class="global-search-shortcut-affordance">
⌘K
</span>
{{/unless}}
</:anchor>
<:header>
<div id="global-search-popover-header">
{{! content is placed here by the in-element helper below }}
</div>
{{#if this.bestMatchesHeaderIsShown}}
<div class="global-search-best-matches-header">
<h5>Best matches</h5>
</div>
{{/if}}
</:header>
<:item as |dd|>

{{#if dd.attrs.itemShouldRenderOut}}
{{!
We use this property to catch the "view all results" and "view all [productArea] documents" items and, for semantic purposes, render them outside of the DropdownList's primary `ul/ol` element while still retaining the keyboard navigability provided by the DropdownList component.
}}
{{#unless this.searchInputIsEmpty}}
{{#in-element
(html-element "#global-search-popover-header")
insertBefore=null
}}
{{#if (eq dd.value "viewAllResultsObject")}}
<dd.LinkTo
{{did-insert this.registerViewAllResultsLink}}
@route="authenticated.results"
@query={{hash q=this.query page=1}}
class="global-search-popover-header-link"
>
<FlightIcon @name="search" class="mr-1.5" />
<span>View all results for “{{this.query}}”</span>
</dd.LinkTo>
{{else if (eq dd.value "productAreaMatch")}}
<dd.LinkTo
data-test-product-match-link
@route="authenticated.all"
@query={{hash product=(array product)}}
class="hds-dropdown-list-item--variant-interactive"
@query={{hash product=(array dd.attrs.product) page=1}}
class="global-search-popover-header-link border-t border-t-color-border-primary"
>
<FlightIcon @name="folder" class="mr-1.5" />
<span class="flex items-center">View all
<span class="flex items-center">
View all
<Hds::Badge
@text={{product}}
@icon={{get-product-id product}}
class="mx-2"
@text={{dd.attrs.product}}
@icon={{get-product-id dd.attrs.product}}
class="mx-2 mix-blend-multiply"
/>
documents
</span>
</LinkTo>
{{/let}}
</div>
<div id="bestMatches" class="flex flex-col pt-1">
<span
class="hds-typography-body-100 hds-font-weight-medium hds-foreground-faint px-3 py-1"
>Best matches</span>
{{#each this.bestMatches as |match|}}
<Doc::Inline
@avatar="{{get match.ownerPhotos 0}}"
@docID="{{match.objectID}}"
@docNumber="{{match.docNumber}}"
@isResult="{true}"
@owner="{{get match.owners 0}}"
@productArea="{{match.product}}"
@snippet="{{match._snippetResult.content.value}}"
@status="{{match.status}}"
@title="{{match.title}}"
</dd.LinkTo>
{{/if}}
{{/in-element}}
{{/unless}}
{{else}}
<dd.LinkTo
data-test-search-result
@route="authenticated.document"
@model={{dd.value}}
class="global-search-result"
>
<Doc::Thumbnail
@status={{dd.attrs.status}}
@product={{dd.attrs.product}}
/>
<div class="global-search-result-text-content">
<h4 class="global-search-result-title">
{{dd.attrs.title}}
</h4>
<Person
data-test-search-result-owner
@ignoreUnknown={{true}}
@imgURL={{get dd.attrs.ownerPhotos 0}}
@email={{get dd.attrs.owners 0}}
/>
{{#if dd.attrs._snippetResult.content.value}}
<Doc::Snippet
data-test-search-result-snippet
@snippet={{dd.attrs._snippetResult.content.value}}
class="truncate"
/>
{{/each}}
</div>
{{else}}
<div class="flex flex-col border-0 hds-border-primary pb-1">
<div class="py-1 px-3">
<span class="flex items-center">No results found for "{{this.query}}"</span>
</div>
{{/if}}
</div>
{{/if}}
</dd.Content>
{{/if}}
</BasicDropdown>
</dd.LinkTo>
{{/if}}
</:item>
</X::DropdownList>
</form>
</div>
Loading