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

Fix single button action icon attribute #3006

Merged
merged 2 commits into from
Aug 11, 2022

Conversation

PVince81
Copy link
Contributor

Actual:
image

Expected:

The icon should appear.

It already works with this format when inside the popover, it's only when there's only a single action that it doesn't.

The component is used that way in many places in the server, see nextcloud/server#33508 (comment)

@PVince81 PVince81 added bug Something isn't working regression Regression of a previous working feature labels Aug 11, 2022
@PVince81 PVince81 changed the title Add styleguide example for single button icon using attr Fix single button action icon attribute Aug 11, 2022
@PVince81
Copy link
Contributor Author

works now:
image

the old button on stable5 was rendered directly and using the class https://github.com/nextcloud/nextcloud-vue/blob/stable5/src/components/Actions/Actions.vue#L181-L182

so this fix also passes the icon attribute if the icon slot is not used

@PVince81 PVince81 self-assigned this Aug 11, 2022
@PVince81 PVince81 added the 3. to review Waiting for reviews label Aug 11, 2022
@PVince81 PVince81 marked this pull request as ready for review August 11, 2022 19:47
@raimund-schluessler
Copy link
Contributor

At least from my side, this is a "planned regression" aka breaking change. When moving the Actions component to a render function in #2911 I didn't implement icon-classes for the single action button icon. This is for two reasons, mainly:

  • We use the Button component as the single action trigger and the Button component does not easily support icon-classes but uses an icon slot for material design icons.
  • I was under the impression that using icon-classes is discouraged now with the changes in server.

From my side, the proper solution is to populate the icon slot of the ActionElements (i.e. ActionButton, ÀctionLink` etc.), which then makes the single action trigger icon appear. This is more work on the server side, but the "future proof" and clean solution, imho.

The other approach would be to re-implement icon-classes for the Actions menu, but that wouldn't be so nice and a bit hacky.

I would like to hear what @skjnldsv things about this.

@PVince81
Copy link
Contributor Author

PVince81 commented Aug 11, 2022

the icon classes still seem to be working when inside the menu, so probably they were not fully removed

from my understanding the reason we wanted the new Actions impl was because it was the only way to also fix the infinite loop related to floating vue, and we definitely want floating vue on the server for accessibility reasons, but don't have time yet to adjust all apps to move away from using icons

so I'm not sure if now is the right time to remove the icon classes ?

let's see what others say

@PVince81
Copy link
Contributor Author

and thanks for clarifying!

@PVince81 PVince81 merged commit 2546ec0 into master Aug 11, 2022
@PVince81 PVince81 deleted the bug/noid/missing-icon-from-attr-single-action branch August 11, 2022 20:00
@PVince81
Copy link
Contributor Author

as we need to move forward a bit quickly, I've merged this now

I've raised #3007 to continue the discussion and to plan the removal of icon support

PVince81 added a commit that referenced this pull request Aug 11, 2022
Since #3006 removes the breaking part of #2911, it was moved to
enhancements

Signed-off-by: Vincent Petry <[email protected]>
@PVince81 PVince81 mentioned this pull request Aug 11, 2022
2 tasks
@raimund-schluessler
Copy link
Contributor

I guess the solution is simple enough to have it implemented, so fine with me. But what still does not work is multiple actions with custom icon class:

<Actions default-icon="icon-edit">
	<ActionButton icon="icon-edit" @click="alert('Edit')">Edit</ActionButton>
	<ActionButton icon="icon-delete" @click="alert('Delete')">Delete</ActionButton>
	<ActionLink icon="icon-external" title="Link" href="https://nextcloud.com" />
</Actions>

@PVince81
Copy link
Contributor Author

PVince81 commented Aug 11, 2022

@raimund-schluessler it worked on this PR, this is why I modified one of the examples to use an attr icon, see:

image

and also it was working on nextcloud/server#33508 (comment) from the dropdown menus which also use icon attributes: https://github.com/nextcloud/server/blob/update-nextcloud-vue-6.0.0-beta.1/apps/files_sharing/src/components/SharingEntryLink.vue#L285

image

@PVince81
Copy link
Contributor Author

... and because it was working it made me wonder if something got omitted/forgotten during the Actions port to render function

@PVince81
Copy link
Contributor Author

bad screenshot, the slot is populated, will do another one

@PVince81
Copy link
Contributor Author

I've updated the screenshot in #3006 (comment) with the styleguide from master where I unpopulated the slot and use only attr for inside the menu

@raimund-schluessler
Copy link
Contributor

That's not what I mean. You could overwrite the multiple actions trigger icon with the default-icon prop of Actions.
See here:
Bildschirmfoto vom 2022-08-11 22-27-22

This should show the icon-edit as menu trigger icon, but it shows the three dot icon instead.

@raimund-schluessler
Copy link
Contributor

I removed the default-icon prop in #2911, because I though it's not desired anymore. You will need to re-add it to make it fully backwards compatible. See here:
https://github.com/nextcloud/nextcloud-vue/blob/601f4208e542ca51b82937c1c1a5c2db25d8b2ab/src/components/Actions/Actions.vue#L299-L307

@raimund-schluessler
Copy link
Contributor

I will provide a PR later today.

@PVince81
Copy link
Contributor Author

@raimund-schluessler thanks a lot for bringing this up, clarifying and looking forward to your PR :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working regression Regression of a previous working feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants