Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fixes a broken link and set margin around links on authentication dialog #8208

Closed
wants to merge 38 commits into from
Closed

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Mar 31, 2022

Closes element-hq/element-web#21624

  • Add margin around links
  • Fix the bug that Go back link is enabled over the row
  • Also add the role to the error div

after

type: defect

Signed-off-by: Suguru Hirahara luixxiul@users.noreply.github.com


Here's what your changelog entry will look like:

🐛 Bug Fixes

Preview: https://pr8208--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

Closes element-hq/element-web#21624

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
@luixxiul luixxiul requested a review from a team as a code owner March 31, 2022 13:39
@luixxiul luixxiul changed the title Fixes a broken link and set margin around links Fixes a broken link and set margin around links on authentication dialog Mar 31, 2022
@github-actions github-actions bot added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label Mar 31, 2022
@codecov
Copy link

codecov bot commented Mar 31, 2022

Codecov Report

Merging #8208 (53eb605) into develop (942ca74) will decrease coverage by 0.92%.
The diff coverage is 50.00%.

❗ Current head 53eb605 differs from pull request most recent head c9e25a9. Consider uploading reports for the commit c9e25a9 to get more accurate results

@@             Coverage Diff             @@
##           develop    #8208      +/-   ##
===========================================
- Coverage    30.74%   29.82%   -0.93%     
===========================================
  Files          892      875      -17     
  Lines        50681    50024     -657     
  Branches     12900    12727     -173     
===========================================
- Hits         15584    14918     -666     
- Misses       35097    35106       +9     
Impacted Files Coverage Δ
src/components/views/auth/CaptchaForm.tsx 4.34% <ø> (ø)
src/components/structures/auth/Registration.tsx 29.26% <50.00%> (-0.91%) ⬇️
...list/algorithms/tag-sorting/AlphabeticAlgorithm.ts 0.00% <0.00%> (-100.00%) ⬇️
src/utils/colour.ts 0.00% <0.00%> (-94.12%) ⬇️
src/autocomplete/EmojiProvider.tsx 16.27% <0.00%> (-72.86%) ⬇️
...c/stores/room-list/algorithms/tag-sorting/index.ts 14.28% <0.00%> (-71.43%) ⬇️
src/components/views/elements/FacePile.tsx 10.00% <0.00%> (-67.78%) ⬇️
src/autocomplete/AutocompleteProvider.tsx 0.00% <0.00%> (-60.72%) ⬇️
...list/algorithms/list-ordering/OrderingAlgorithm.ts 0.00% <0.00%> (-57.15%) ⬇️
...stores/room-list/algorithms/list-ordering/index.ts 14.28% <0.00%> (-57.15%) ⬇️
... and 105 more

@kerryarchibald kerryarchibald requested a review from a team March 31, 2022 16:14
@@ -614,8 +614,8 @@ export default class Registration extends React.Component<IProps, IState> {
onServerConfigChange={this.state.doingUIAuth ? undefined : this.props.onServerConfigChange}
/>
{ this.renderRegisterComponent() }
{ goBack }
{ signIn }
<div className="mx_AuthBody_link_goBack">{ goBack }</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The margins of mx_Dialog_buttons_items will still be applied even when goBack is falsy, creating a weird gap in the UI when we don't render a go back button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess you are talking about #8160?

{ goBack }
{ signIn }
<div className="mx_AuthBody_link_goBack">{ goBack }</div>
<div className="mx_AuthBody_link_signIn">{ signIn }</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The margin styles you define for these wrappers can be added to the style of the signIn and goBack elements themselves - both use the class mx_AuthBody_changeFlow
It's unnecessary to introduce more wrapping elements.

Copy link
Contributor Author

@luixxiul luixxiul Apr 1, 2022

Choose a reason for hiding this comment

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

OK, I am going to fix the bug of the link with specifying additional rules. Actually mx_AuthBody_changeFlow of those elements do nothing here. You need a wrapper anyway, in order to place an inlined element at the center. There could be another way of achieving that, but it needs an unnecessarily complicated solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed: dbdf83d

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed: ca411f7.

TODO: margin setting. See below.

}

.mx_AuthBody_link_goBack {
margin: 12px auto 6px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the spacing variables for standard spacings https://github.com/matrix-org/matrix-react-sdk/blob/develop/res/css/_spacing.scss

@@ -94,6 +94,22 @@ limitations under the License.
background-color: $authpage-focus-bg-color;
}
}

.mx_recaptchaContainer {
.mx_recaptchaContainer_info,
Copy link
Contributor

Choose a reason for hiding this comment

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

mx_recaptchaContainer_info is a specific selector, it does not need to be nested.

Copy link
Contributor Author

@luixxiul luixxiul Apr 1, 2022

Choose a reason for hiding this comment

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

Generally semantic specificity does not prevent unexpected visual regressions. Nesting should. It also should serve its function not only on large SASS files but also on tiny ones, as checking visual regressions for the latter is a difficult task if there is not an automated test available. Setting an insurance is better than leaving them vulnerable to possibility of the regressions. If you don't have a strong opinion against it, I would rather keep this nested until another element outside of it requires this.

{ this.state.errorText }
</div>
);
}

return (
<div ref={this.recaptchaContainer}>
<p>{ _t(
<div className="mx_recaptchaContainer" ref={this.recaptchaContainer}>
Copy link
Contributor

Choose a reason for hiding this comment

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

We prefix our classes with the component they are styling - so the classes you've added should be mx_CaptchaForm_recaptchaContainer, mx_CaptchaForm_recaptchaContainerInfo etc
This is explained a bit more in the css rules in the developer guide https://github.com/matrix-org/matrix-react-sdk/blob/develop/README.md#developer-guide

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for letting me know about that guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed: 9425477

@@ -94,6 +94,22 @@ limitations under the License.
background-color: $authpage-focus-bg-color;
}
}

.mx_recaptchaContainer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Components should have their own style files, since these classes are used in CaptchaForm component they should be in _CaptchaForm.scss. This helps keep our components independent and maintainable.

Please move these into the correct file (and don't forget to run yarn rethemendex when adding new scss files)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed: 42874a9

As long as mx_AuthBody_changeFlow is specified to the AccessibleButton,
the link may not be inlined as expected because of mx_AuthBody_changeFlow's
styles (display: block & width: 100%). We need a wrapper anyway.

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
luixxiul added 8 commits April 1, 2022 16:37
mx_CaptchaForm_*

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Setting "p" tag instead of "mx_CaptchaForm_recaptchaContainer_info"
would be too broad.

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
@luixxiul
Copy link
Contributor Author

luixxiul commented Apr 10, 2022

I am having trouble of comprehending the usage of the spacing variables.

  • For which properties should the variables be used? Padding inside of an element? Margin between elements?
  • Should the variables be used as value of gap too?
  • Should spacing be done only with the absolute unit px as specified in _spacing.scss? Is there not a case where relative units such as rem would be preferred?

I also would like to know where the standardized usage of them is published and the guideline and documentation about it are available.

Answers would be very appreciated. Thank you in advance.

Edit: I've accustomed to the usage of the variables, so it is no longer a problem for me, while it does not mean the style guide about the usage is unnecessary.

@t3chguy t3chguy requested a review from kerryarchibald May 9, 2022 06:08
luixxiul added 2 commits May 13, 2022 02:48
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
@luixxiul
Copy link
Contributor Author

Please review this one. thanks.

@andybalaam
Copy link
Member

@kerryarchibald

@MadLittleMods MadLittleMods added the Z-Community-PR Issue is solved by a community member's PR label Jun 1, 2022
@luixxiul
Copy link
Contributor Author

@turt2live If this PR is not really necessary, please let me know...

Copy link
Contributor

@janogarcia janogarcia left a comment

Choose a reason for hiding this comment

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

@turt2live @luixxiul Yeah, let's please close this PR. It seems to have been addressed already in recent updates.

Screenshot from production app:

Element

@luixxiul luixxiul closed this Jun 17, 2022
@luixxiul luixxiul deleted the Captcha branch June 17, 2022 08:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link placement on authentication dialog should be fixed
5 participants