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

[A11Y] Replace invalid link elements with buttons #3021

Closed
wants to merge 6 commits into from

Conversation

davwheat
Copy link
Member

@davwheat davwheat commented Aug 12, 2021

Fixes #3519

Changes proposed in this pull request:

  • Replace links with no or dead hrefs with <button> elements
  • Add new .Button--reset class which removes all native styles from buttons
  • Don't use .box-shadow() mixin. It's unneeded and bloats the CSS.

Reviewers should focus on:

Anywhere I've missed? Should the Link be removed from "dead" authors?

Screenshot

image

Confirmed

  • Frontend changes: tested on a local Flarum installation.

@davwheat davwheat added the type/accessibility Issues relating to accessibility (keyboard navigation, screenreaders, text contrast, etc.) label Aug 12, 2021
@davwheat davwheat added this to the 1.1 milestone Aug 12, 2021
@davwheat davwheat requested a review from SychO9 August 12, 2021 16:38
@davwheat davwheat self-assigned this Aug 12, 2021
Copy link
Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

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

To me, reset implies that it's using browser native button styling. Is there a convention behind this naming? Maybe Button--text?

@SychO9
Copy link
Member

SychO9 commented Aug 14, 2021

I haven't reviewed yet, but we have Button--link and Button--text, don't one of these do the job ?

@davwheat
Copy link
Member Author

davwheat commented Aug 14, 2021

Unfortunately not. Button--link keeps the button padding and creates incorrect vertical alignment, and Button--text results in incorrect vertical alignment and undesired underlining on hover/focus.

We definitely don't want the underlining in some places (post scrubber for example), but other areas I'd be open to ("links" in modals).

@SychO9
Copy link
Member

SychO9 commented Aug 14, 2021

Ah I see, makes sense.

btw, I believe we can do all: unset here :D found out about it recently!

@askvortsov1 askvortsov1 modified the milestones: 1.1, 1.2 Sep 28, 2021
@dsevillamartin
Copy link
Member

Not tested the changes or really looked at CSS, mainly focused on JS.
My thoughts are basically on cleaning this up rather than anything else -

We could potentially have a <Component/Tag> variable that switches between Link and span to avoid this code duplication. Don't know if that'd be better or worse - potentially create a separate component that chooses the tag (including <Button> reset for onclick)? 🤔

That way it would avoid writing Button Button--reset every time (unless we explicitly want it) or handling falsy href/onclick's, as the component would do that too.

&:focus,
&.focus,
Copy link
Member

Choose a reason for hiding this comment

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

Won't moving these styles from --link to --reset be breaking if the button doesn't update to use --reset with a dropdown toggle? Is it a big deal?

@dsevillamartin
Copy link
Member

dsevillamartin commented Oct 16, 2021

For example, the timestamp in posts now uses the primary color. If this happens here, will probs happen with exts - not that big of a breaking change though, so I don't know how much we want that to prevent these changes.

Images are before vs after.

image image

image
image

less/common/Button.less Outdated Show resolved Hide resolved
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

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

The Button--reset looks fine with the scrubber buttons, but odd with the rest.

@@ -29,9 +30,9 @@ export default class PostMeta extends Component {

return (
<div className="Dropdown PostMeta">
<a className="Dropdown-toggle" onclick={selectPermalink} data-toggle="dropdown">
<Button className="Button Button--reset Dropdown-toggle" onclick={selectPermalink} data-toggle="dropdown">
Copy link
Member

Choose a reason for hiding this comment

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

the timestamp looks colored at all times, can we instead use Button--text here and just add a vertical-align: bottom; to .Button--text ? it's a lot more consistent.

Comment on lines +128 to +136
<Button class="Button Button--reset" onclick={this.forgotPassword.bind(this)}>
{app.translator.trans('core.forum.log_in.forgot_password_link')}
</Button>
</p>,

app.forum.attribute('allowSignUp') ? (
<p className="LogInModal-signUp">{app.translator.trans('core.forum.log_in.sign_up_text', { a: <a onclick={this.signUp.bind(this)} /> })}</p>
<p className="LogInModal-signUp">
{app.translator.trans('core.forum.log_in.sign_up_text', {
a: <Button class="Button Button--reset" onclick={this.signUp.bind(this)} />,
Copy link
Member

Choose a reason for hiding this comment

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

these look weird as well, colored with no effect on hover, the underline hovering effect of the link was nice.
perhaps we should add a new Button--textlink that would mimic an exact link?

@askvortsov1 askvortsov1 requested a review from SychO9 November 17, 2021 19:26
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

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

Already left a review 👼🏼

@SychO9 SychO9 modified the milestones: 1.2, 1.3 Dec 31, 2021
@askvortsov1 askvortsov1 removed this from the 1.3 milestone Mar 10, 2022
@askvortsov1
Copy link
Member

Hello, thank you for your pull request! In order to speed up future development, keep all work in one place, and take advantage of CI tools that can help us avoid breaking changes, we have moved all Flarum code to a single monorepo at flarum/framework. You can read more about this process in our dev diary. Unfortunately, pull requests can't be carried over to the monorepo, so we have to close all open pull requests. If this pull request is still relevant, please feel free to reopen it over on the monorepo. We apologize for the inconvenience, and hope you will consider contributing to Flarum again in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/accessibility Issues relating to accessibility (keyboard navigation, screenreaders, text contrast, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[A11Y] Convert empty links to button elements
4 participants