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

[OF#3450] Fix styling issues of progress indicator #597

Closed
wants to merge 3 commits into from

Conversation

vaszig
Copy link
Contributor

@vaszig vaszig commented Nov 21, 2023

Fixes open-formulieren/open-forms#3450
Fixes open-formulieren/open-forms#2139
Fixes #36

  • Hyphenation rules are language-specific. In HTML, the language is determined by the lang attribute, so in our situation the browser will detect the language. The browser is free to automatically break words at appropriate hyphenation points when we define hyphens: auto
  • Generally it's not wrong pattern to have multiple nav elements in a single page. I have added aria-labelledby to the nav in case we embed the form (OpenInwoner already has a nav).

@vaszig vaszig marked this pull request as draft November 21, 2023 08:13
Copy link

codecov bot commented Nov 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7aee061) 72.00% compared to head (795e216) 72.27%.
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #597      +/-   ##
==========================================
+ Coverage   72.00%   72.27%   +0.26%     
==========================================
  Files         213      213              
  Lines        4319     4324       +5     
  Branches     1152     1156       +4     
==========================================
+ Hits         3110     3125      +15     
+ Misses       1162     1160       -2     
+ Partials       47       39       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vaszig
Copy link
Contributor Author

vaszig commented Nov 22, 2023

FYI: I wanted to approach the scrolling of the steps menu (mobile version) by targeting-selecting the parent class of the progress-indicator and add there the necessary rules but I read that this is not supported by all browsers, so I did this in a different way which I am not sure if it is correct.

Another solution would be to refactor the whole progress indicator structure of the elements which I don't know if it is worth doing it.

@vaszig vaszig marked this pull request as ready for review November 22, 2023 15:23
@sergei-maertens sergei-maertens self-assigned this Nov 23, 2023
@sergei-maertens sergei-maertens self-requested a review November 23, 2023 11:13
Remove padding on mobile story since we use the full viewport width,
only apply the layout decorator to non-mobile stories.
Copy link
Member

@sergei-maertens sergei-maertens left a comment

Choose a reason for hiding this comment

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

I'm trying out some things, discussed a bit on Slack as well and I need to time to investigate. The layout refactor caused a regression with the PI on desktop too - it is no longer (properly) sticky when scrolling down on large steps, but it also raises a concern for if there are many steps - how would that look and would it still be properly scrollable?

@@ -201,3 +201,93 @@ export const ActiveSubmission = {
await userEvent.click(beginButton);
},
};

export const SeveralStepsInMobileViewport = {
Copy link
Member

Choose a reason for hiding this comment

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

there are a bunch of prop type warnings in the console for this story, can you resolve those?

I also suspect some mocks are missing since I'm seeing network errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The prop types are gone (fixed).

Concerning the mocks I don't get any errors only if I change the base url (like we have to do in order to see the results on a real phone). Is this what you mean?

Copy link
Member

Choose a reason for hiding this comment

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

thanks! I think I will cherry pick some of your changes in what will become the final branch. I've learned a lot today and there are bits and pieces that I want to re-use, but ultimately I will throw away all existing CSS and re-build it to get rid of the cruft we've collected 😬

src/components/App.stories.js Show resolved Hide resolved
src/components/App.stories.js Show resolved Hide resolved
src/components/Caption.js Show resolved Hide resolved
@@ -36,15 +38,17 @@ const ProgressIndicator = ({

return (
<Card blockClassName="progress-indicator" modifiers={modifiers}>
<nav>
<nav aria-labelledby="proress-indicator-section">
Copy link
Member

Choose a reason for hiding this comment

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

typo in ID

Suggested change
<nav aria-labelledby="proress-indicator-section">
<nav aria-labelledby="progress-indicator-section">

additionally you want to namespace IDs/have them be unique since the ID could already be present when embedding in a CMS page.

Perhaps using a UUID is more robust for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean to generate a UUID here?

Comment on lines +72 to +78
.openforms-theme {
.utrecht-link {
@include bem.modifier('openforms-active') {
font-weight: bold;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

why not apply utrecht-link--current classname? There is a design token for this: --utrecht-link-current-font-weight.

src/scss/components/_app.scss Show resolved Hide resolved
Comment on lines +84 to +91
@include bem.modifier('mobile-expanded') {
top: 0;
left: 0;
position: fixed;
width: 100%;
height: 100%;
overflow-y: auto;
}
Copy link
Member

Choose a reason for hiding this comment

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

Couple problems - I've added a dummy nav element that could/would be present on a CMS page where the SDK is being embedded. You can assume that this will also have mobile/responsive menu where it is "glued" to the top of the page and that this nav should be available at all times:

image

HTML:

image

When I open the PI, it overlays the entire page:

image

I'm not sure if this is desirable or not 🤔 it's easy enough to dismiss it again, but it also a bit weird that it takes over the entire screen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, it depends on how we want it to behave. If this should be a simple dropdown the approach is wrong. If we want it to be like a button which opens a popup then it's kind of correct, and I am saying kind of because what it really does is hiding the background. If someone changes the position the begin button could be clicked.

Copy link
Member

Choose a reason for hiding this comment

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

I've done some sketching on paper on what the desired behaviour is, I'll make sure to document that on the components so that it's visible in storybook documentation. It's an overlay that expands to the bottom - it does not necessarily need to cover the entire screen (but it's also fine if it does). It needs to play well with headers and footers above/below the form though.

@sergei-maertens
Copy link
Member

Replaced by #603

@sergei-maertens sergei-maertens deleted the task/2139-3450-fix-progress-indicator-styling branch March 20, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants