-
Notifications
You must be signed in to change notification settings - Fork 78
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
feat(navigation, navigation-logo, navigation-user): Add navigation, navigation-logo & navigation-user components. #6873
feat(navigation, navigation-logo, navigation-user): Add navigation, navigation-logo & navigation-user components. #6873
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial review! LOoking good! 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way to use assets in demo pages? Maybe we can use url if these are publicly available to not include in project.
…/github.com/Esri/calcite-components into anveshmekala/6531-feat-navigation-component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff, @anveshmekala!
Once the setFocus
and navigation action prop/event renames are addressed, this should be good to merge!
render(): VNode { | ||
return ( | ||
<Host> | ||
<a href={this.href} tabindex={0}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to set tabindex
here as anchor's is 0 by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tabIndex still needs to be set here because the default 0 is applied only when href has a valid value or an empty string. I tried adding empty string which results in reload of page. Later changed to "#" which affects a11y instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could do tabindex={!this.href ? 0 : null}
. href should be a required prop though right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabindex={!this.href ? 0 : null}
this will over-ride the default tabindex value 0
with null
when href is defined and href
is not a required prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add rel
& target
prop here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, it should probably follow calcite-button
logic and render either a button or a anchor depending on the existence of href.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think href
should be a required attribute for logo. Is there an added advantage of rendering a button when href is undefined
besides click event being emitted on Space
keydown ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would just be a11y concerns. An anchor should take you somewhere (either on the page or off) whereas as button should perform some action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when href is undefined
& text-enabled is false
, VoiceOver is reads out the logo as {label} name, image
.
when href is undefined
& text-enabled is true
, VoiceOver focuses the image reading the instruction as {label} name, image
and then user can move on to the text which is read out.
The only time VoiceOver recognizes logo as link
is when user adds href. When both href
and label
are undefined
, the instructions recognizes logo as clickable
element.
Tested with VoicOver and safari 16.4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
synced-up with kitty today.
Updates regarding navigation-logo a11y:
- tabindex default value is removed because logo shouldn't be in the focus order when href is null value.
- AT user should be able to hear out image (if label is defined), heading & description context.
- Screen readers will recognize logo as link if href is defined.
expect(eventSpy).toHaveReceivedEventTimes(1); | ||
|
||
await page.keyboard.press("Space"); | ||
await page.waitForChanges(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think waitForChanges
is needed here as it wasn't needed for Enter
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing without waitForChanges
on Space
key . I see that waitForChanges
is added in many other instances on Space
keydown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff, @anveshmekala!
Once the setFocus
and navigation action prop/event renames are addressed, this should be good to merge!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 👍 💯
@Prop() label: string; | ||
|
||
/** Specifies the subtext to display, such as an organization or application description. */ | ||
@Prop() subtext: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe be named description
to be consistent with other props?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use description here considering we change the text
attribute to something like name
or label
.
cc @jcfranco
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to heading and description. Wondering if we should drop textEnabled
prop and render heading
& description
if provided by the user.
return ( | ||
<Host> | ||
<button aria-label={this.label}> | ||
<calcite-avatar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I wonder if it might make more sense to just have them slot the <calcite-avatar>
instead of this component having all the same props?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for having a separate component is to restrict the users from setting the scale which can cause layout issues in navigation context me thinks. We can considering re-using avatar
component by rendering username
& fullName
in the DOM and adjusting scaling based on CSS selectors to identify if its slotted inside navigation component.
WDYT @macandcheese @jcfranco
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could always modify the scale of the avatar onslotchange.
Related Issue: #6531
Summary
This PR adds the following components:
Co-authored by @macandcheese
Extracted from #6829
calcite-navigation
Usage
Basic
Properties
label
(required)label
navigationAction
istrue
, specifies the label of thecalcite-action
.string
undefined
navigationAction
navigation-action
true
, displays acalcite-action
and emits acalciteNavActionSelect
event on selection change.boolean
false
Events
calciteNavigationActionSelect
navigationAction
is true, emits when the displayed action selection changes.CustomEvent<void>
Methods
setFocus() => Promise<void>
When
navigation-action
istrue
, sets focus on the component's action element.Returns
Type:
Promise<void>
CSS Custom Properties
--calcite-navigation-background
--calcite-navigation-border-color
--calcite-navigation-width
Dependencies
Depends on
calcite-navigation-logo
Usage
Basic
Properties
active
active
boolean
undefined
description
description
heading
.string
undefined
heading
heading
string
undefined
href
href
string
undefined
label
label
thumbnail
. If no label is provided, context will not be provided to assistive technologies.string
undefined
rel
rel
href
value and the current document.string
undefined
target
target
href
property.string
undefined
thumbnail
thumbnail
src
to an image.string
undefined
Methods
setFocus() => Promise<void>
Sets focus on the component.
Returns
Type:
Promise<void>
calcite-navigation-user
Usage
Basic
Properties
active
active
boolean
undefined
fullName
full-name
string
undefined
label
label
string
undefined
textDisabled
text-disabled
true
, hides thefullName
andusername
contents.boolean
false
thumbnail
thumbnail
src
to an image (remember to add a token if the user is private).string
undefined
userId
user-id
string
undefined
username
username
string
undefined
Methods
setFocus() => Promise<void>
Sets focus on the component.
Returns
Type:
Promise<void>
Dependencies
Depends on