-
Notifications
You must be signed in to change notification settings - Fork 77
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
Action: No way to set href for links #9138
Comments
I think we should discuss this one a bit first. Since the action component is used within action-bar (toolbar), I'm not sure it would make sense to support some of the actions being links. In this case, why can't they use a |
Some of the concerns i have
Can we research the accessibility issues and look into the UX a bit? I could see it being problematic when we are stying both a button and a link to look exactly the same with no visual difference to an end user. Its also weird for a component's role to change dynamically whether its a link or not. Maybe these should be separate components in order to avoid the confusion and potential a11y issues. |
In the use case, teams were using
Makes sense on the URL opening, think this speaks to having the dev add in a meaningful
Believe the |
I don't see an issue with allowing Action to conditionally render as a anchor - it's the same in Button currently. Ultimately the onus of making the UX make sense and actions apparent to a user falls to the implementer - so the same as any of our current components. There are definitely places where using an Action inline in this way is preferable to a Button for UI - internally the Button renders an anchor or button element, so seems reasonable to have Action behave the same way. Ultimately it's a different UI expectation than Button. |
It's not exactly the same as button. Button doesn't have any parent components like action-bar that will soon expect a toolbar role with buttons inside. If we allow action to be a link this could cause issues with accessibility and expected roles. We would have to specify in documentation not to do this. This kind of doc leads me to believe separate components might make more sense here. Like an action-link? I think we should spike and discuss this. Specifically if components should change role internally depending on a property value (anchor link vs button). A separate discussion involving design should be made to whether links and buttons can or should look exactly the same as that could be confusing to an end user because there would be no way to visually tell them apart. |
Yeah, we should verify those use cases and it might come down to doc. From the design side - we already have the same set up in Link and Button - each renders either an |
Having a button render a link or a link render a button has always seemed off to me. I just wanted to bring it to get more attention. We will just need to document correct usage. |
Yeah, totally fair. Link especially as that one insinuates For Button, it's pretty common to render either a / button based on That said, some like Atlassian have (newly introduced) distinct components for Icon Button, Link Button, Split Button, etc. |
@macandcheese @driskull Are we still going with the original requirements + doc updates, or do we need to explore alternatives? |
I'd think it is still useful to add that functionality as Action are often used for similar UX needs as Buttons, but will defer to others. |
I think we can proceed with this, we'll just have to document best practices and accessibility guidelines. The end user may not be able to tell the difference between an action that will perform some JS action vs one that changes your browser's URL but this is really an app decision to make A lot of the API will only apply when href is used. (download, rel, target) and there are other anchor attributes that are missing like (hreflang, ping, referrerpolicy, type). |
Check existing issues
Actual Behavior
It is not currently possible to have an
action
be a link.Expected Behavior
Expecting the same behavior as
button
(and eventuallysplit-button
's primary button via #9126) where I can pass an href and the inner button element will become a styled link and the props get reflected properly.Should include the following native props:
href
target
rel
download
Reproduction Sample
https://codepen.io/geospatialem/pen/JjVZgNL
Reproduction Steps
open
methodReproduction Version
2.7.1
Relevant Info
No response
Regression?
No response
Priority impact
p3 - want for upcoming milestone
Impact
No response
Calcite package
Esri team
ArcGIS Map Viewer
The text was updated successfully, but these errors were encountered: