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

feat(breadcrumb): added href and stopped event default on a element #1169

Closed
wants to merge 1 commit into from

Conversation

emoral435
Copy link
Contributor

@emoral435 emoral435 commented Jan 12, 2024

☑️ For nextcloud/server#42624

🖼️ Screenshots

🏚️ Before 🏡 After
image firefox_s9J1mvZeTU

GIF For New Changes

firefox_tPXw1ltV1S

🚧 Summary

Added an HREF attribute to the link element. Once this gets merged / challenged / changed, will update the library in nextcloud/server

Signed-off-by: Eduardo Morales <emoral435@gmail.com>
@emoral435 emoral435 added bug Something isn't working 3. to review accessibility for accessibility work or changes labels Jan 12, 2024
@emoral435 emoral435 added this to the 5.0.4 milestone Jan 12, 2024
@emoral435 emoral435 self-assigned this Jan 12, 2024
@emoral435
Copy link
Contributor Author

As a follow up - as I prevented the default action for this a element, it therefor has become disabled, however, we will use it as a button. While this works, would it not make more sense to make each element a NcButton element?

@emoral435
Copy link
Contributor Author

/backport to stable28

Comment on lines +125 to +128
/**
* Gets the current url path
*/
const getPath = computed(() => window.location.pathname)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: window.location.pathname is not reactive. So computed won't recalculate on pathname change. If the location is not supposed to be changed, it can be a plain constant. If it can change, it should be a method (it is called as a method already).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But speaking about the issue, I don't think it should be a link at all. With this implementation, a user has a list of links, all to the current page.

Probably, NcBreadcrumb should support rendering as a button when non to and href is provided.

cc @susnux and @JuliaKirschenheuter for a second opinion here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your second comment, rendering it as a link does not make any sense in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in this case, the way that these breadcrumbs are handled are that they each emit an event to reload the popup window, but it does not redirect the user to a different URL! So, I do agree, I think because the href in the breadcrumbs is essentially useless, we should change this to a list of buttons that have the same emit

@@ -3,7 +3,8 @@
<template #default>
<NcBreadcrumb :name="t('Home')"
:title="t('Home')"
@click="emit('update:path', '/')">
:href="getPath"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this makes sense, this will be the current app which might be something other than files

@emoral435 emoral435 closed this Jan 16, 2024
@emoral435
Copy link
Contributor Author

Closing PR - listened to feedback, and decided that it would be better to render <a/> as <button/> instead! Better semantics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review accessibility for accessibility work or changes bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants