feat: use BaseButton where easily possible #1803

Merged
dpschen merged 7 commits from dpschen/frontend:feature/feat-use-BaseButton-where-possible into main 2022-07-06 21:07:27 +00:00
Member

This replaces links with BaseButton components. BaseButton will use <button type="button"> inside for this case. This improves accessibility a lot. Also we might be able to remove the .stop modifiers in some places because AFAIK the button element stops propagation by default.

I searched for @click listeners in order to find these cases.
It might be that I missed some.
Also there are multiple occasions where an element with a click listener wraps other elements.

This is something that should be avoided whenever possible and instead be implemented by putting an element — our BaseButton — with that click listener inside that spawns over the full parent element size. These kind of fixes are still left, but they should be done since they can be a major source of all kinds of problems (e.g. hitting multiple listeners without knowing at the same time).

This replaces links with BaseButton components. BaseButton will use `<button type="button">` inside for this case. This improves accessibility a lot. Also we might be able to remove the `.stop` modifiers in some places because AFAIK the button element stops propagation by default. I searched for `@click` listeners in order to find these cases. It might be that I missed some. Also there are multiple occasions where an element with a click listener wraps other elements. This is something that should be avoided whenever possible and instead be implemented by putting an element — our BaseButton — with that click listener inside that spawns over the full parent element size. These kind of fixes are still left, but they should be done since they can be a major source of all kinds of problems (e.g. hitting multiple listeners without knowing at the same time).
Author
Member

Note:
I didn't check for possible style implications yet, though they shouldn't be too big.

Note: I didn't check for possible style implications yet, though they shouldn't be too big.
Member

Hi dpschen!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://1803-feature-feat-use-basebutton-wher--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi dpschen! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://1803-feature-feat-use-basebutton-wher--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 7fdbb1ab4c to 2eeb843af1 2022-04-11 18:27:15 +00:00 Compare
dpschen changed title from WIP: feat: use BaseButton where easily possible to feat: use BaseButton where easily possible 2022-04-11 18:34:42 +00:00
Owner

The build seems to fail. Please check where the button was already imported.

The build seems to fail. Please check where the button was already imported.
dpschen changed title from feat: use BaseButton where easily possible to WIP: feat: use BaseButton where easily possible 2022-04-18 18:49:22 +00:00
dpschen force-pushed feature/feat-use-BaseButton-where-possible from aa5dc7ac96 to 51dc1edc8a 2022-04-18 18:50:51 +00:00 Compare
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 51dc1edc8a to 981f059d11 2022-04-23 12:20:45 +00:00 Compare
Author
Member

Fixed failing tests.

Missing:

  • check if styling of buttons still works
Fixed failing tests. Missing: - [x] check if styling of buttons still works
dpschen changed title from WIP: feat: use BaseButton where easily possible to feat: use BaseButton where easily possible 2022-04-23 16:26:46 +00:00
dpschen requested review from konrad 2022-04-23 16:26:56 +00:00
konrad was assigned by dpschen 2022-04-23 16:27:01 +00:00
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 14f8c6e38e to 64425c3afa 2022-04-23 16:38:37 +00:00 Compare
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 64425c3afa to 3dec49ee85 2022-04-23 17:02:38 +00:00 Compare
konrad requested changes 2022-04-25 17:44:45 +00:00
konrad left a comment
Owner

The styling on empty list pages seems broken:

image

As well as the edit button:

image

I think both of these issues come from the fact that a button is a block element and the a is an inline element. And the default styling for links is (obviously) not applied to a <button>.

The styling on empty list pages seems broken: ![image](/attachments/21bfa22c-92d1-4525-bdcf-650edd12486a) As well as the edit button: ![image](/attachments/821c38b8-374d-438b-9ce2-b2120c5edc0b) I think both of these issues come from the fact that a button is a `block` element and the `a` is an `inline` element. And the default styling for links is (obviously) not applied to a `<button>`.
Author
Member

I missed these, thanks.

Now that I changed everything else:
Do you thing it makes even sense to have the default BaseButton display set to block? Maybe inline-block would be better.

I missed these, thanks. Now that I changed everything else: Do you thing it makes even sense to have the default BaseButton `display` set to `block`? Maybe `inline-block` would be better.
Owner

What breaks when we set it to inline-block? I think there's places where it is expected to be block?

What breaks when we set it to `inline-block`? I think there's places where it is expected to be `block`?
Author
Member

Yes. I would need to revert some styles, but I think mostly it shouldn't be too bad.
If used inside of flexbox or grid it doesn't matter if display is block or inline-block.

Yes. I would need to revert some styles, but I think mostly it shouldn't be too bad. If used inside of flexbox or grid it doesn't matter if display is block or inline-block.
Owner

Then I'd say let's try that.

Then I'd say let's try that.
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 3dec49ee85 to c1ff70eea1 2022-05-10 23:12:55 +00:00 Compare
dpschen force-pushed feature/feat-use-BaseButton-where-possible from c1ff70eea1 to 3f160ba368 2022-05-10 23:14:04 +00:00 Compare
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 3f160ba368 to cd9b0925af 2022-05-10 23:15:37 +00:00 Compare
Owner

@dpschen Can you resolve the conflicts?

@dpschen Can you resolve the conflicts?
dpschen force-pushed feature/feat-use-BaseButton-where-possible from cd9b0925af to 8d105df3f8 2022-05-19 21:11:14 +00:00 Compare
Owner

Almost! The styling of the buttons should be the link blue in the cases in the screenshot.

Almost! The styling of the buttons should be the link blue in the cases in the screenshot.
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 8d105df3f8 to c60dee58a9 2022-06-22 18:21:22 +00:00 Compare
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 5da60935c7 to f125ec2045 2022-06-22 19:40:59 +00:00 Compare
Author
Member

Okay I created a new component called ButtonLink. That's a small wrapper around BaseButton that adds back the link style colors.

Although I tried to check everything I'm not 100% sure if I got all the components where ButtonLink is needed.

Okay I created a new component called ButtonLink. That's a small wrapper around BaseButton that adds back the link style colors. Although I tried to check everything I'm not 100% sure if I got all the components where ButtonLink is needed.
dpschen requested review from konrad 2022-06-22 19:48:12 +00:00
Owner

Looks like it is still missing here: (the "What?")

image

Rest looks good!

Looks like it is still missing here: (the "What?") ![image](/attachments/58b10d77-6747-4a66-8e10-ff56176bd5cf) Rest looks good!
3.3 KiB
dpschen force-pushed feature/feat-use-BaseButton-where-possible from a2df294385 to 0a0c046aa1 2022-07-04 21:54:45 +00:00 Compare
Author
Member

Should be fixed in 0a0c046aa1

Should be fixed in https://kolaente.dev/vikunja/frontend/commit/0a0c046aa1f27335014275d5e2c095311b413d78
Owner

Looks good! Please fix the CI error, then this should be good to merge.

Looks good! Please fix the CI error, then this should be good to merge.
konrad approved these changes 2022-07-05 09:13:53 +00:00
dpschen force-pushed feature/feat-use-BaseButton-where-possible from 0a0c046aa1 to d8588b9ca0 2022-07-06 20:54:39 +00:00 Compare
dpschen merged commit f3835d7dfe into main 2022-07-06 21:07:27 +00:00
dpschen deleted branch feature/feat-use-BaseButton-where-possible 2022-07-06 21:07:27 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.