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

ui: restore vscroll to buy/sell orders tables #1142

Merged
merged 1 commit into from Aug 24, 2021

Conversation

martonp
Copy link
Contributor

@martonp martonp commented Jul 31, 2021

Closes #1091

@chappjc chappjc added the UI label Aug 2, 2021
@chappjc
Copy link
Member

chappjc commented Aug 2, 2021

I'm seeing some side-effects:

image

The ordertables and the "Your Orders" have both light gray horizontal and vertical bars that weren't there before.

I can't seem to Inspect them either. The above is Firefox. It's even crazier in Chromium:

image

BTW, there are other pre-existing scroll quirks if you start playing around. One is the main page's horizontal scroll that is there on load but will disappear if you change the window height. Another is that orderform's or one of it's parents like orderPanel like to bee too tall to the point of pushing the Your Orders table off the screen until you refresh and then it is shorter.

@martonp
Copy link
Contributor Author

martonp commented Aug 2, 2021

@chappjc Wow.. I don't see any of those issues when I try on either firefox or brave. Can you try to clear your cache or run in a private tab? Also, are you using windows? Maybe it displays differently on the windows versions of the browsers.

@chappjc
Copy link
Member

chappjc commented Aug 2, 2021

I hard-refreshed both, but will try again. Linux, Firefox developer edition (91b9) and Chromium 92. Will try with
Epiphany too.

BTW, one thing we like to do with frontend change is to bump the url queries on style.css and entry.js in bodybuilder.tmpl. In a perfect world we'd only do that on release, but it tends to solve cache issues during dev.

@chappjc
Copy link
Member

chappjc commented Aug 2, 2021

I don't see the problem on Epiphany (essentially Safari), but it's definitely there on FF and Chromium. It's not easy to see on FF, except in the Your Orders table.

@chappjc
Copy link
Member

chappjc commented Aug 2, 2021

Looks like we should use auto for overflow-y
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow

@chappjc
Copy link
Member

chappjc commented Aug 2, 2021

Actually, I noticed that the style of the scrollbar is quite inconsistent between browsers too, so think we should use our stylish-overflow class.

tbody {
display: block;
width: 100%;
overflow: scroll;
Copy link
Member

Choose a reason for hiding this comment

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

Although I had suggested overflow: auto, I think we should just not set overflow here at all since the parent elements already are stylish-overflow class, which makes a scroll bar with consistent appearance across browsers.

@chappjc chappjc added this to the 0.3 milestone Aug 3, 2021
@martonp
Copy link
Contributor Author

martonp commented Aug 5, 2021

@chappjc I've enabled scrollbars on mac and everything looks pretty good now. Let me know what you see.

Copy link
Member

@chappjc chappjc 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 pretty uncertain about the use of JS to compute heights here. It's also appearing to set heights sub-optimally. Perhaps other devs can make a suggestion regarding responsive design and flex to achieve this more simply with just bootstrap classes.

client/webserver/site/src/js/markets.js Outdated Show resolved Hide resolved
client/webserver/site/src/js/markets.js Outdated Show resolved Hide resolved
@martonp
Copy link
Contributor Author

martonp commented Aug 9, 2021

@chappjc I found a much nicer way to do this without JS. I'll still review this a bit later, but I wanted to check it in so no one else wastes time on it.

@martonp
Copy link
Contributor Author

martonp commented Aug 10, 2021

This is ready for another look.

@buck54321
Copy link
Member

The thing is, we already have stylish-overflow applied to those divs, and it used to work.

<div class="max-h-100 stylish-overflow">

We need to figure out why it stopped working. It was almost certainly a change from #1016.

@chappjc
Copy link
Member

chappjc commented Aug 16, 2021

That's what I realized as well. #1142 (comment)
I think the responsive design changes lacked a max-height, but not sure.

@martonp
Copy link
Contributor Author

martonp commented Aug 16, 2021

What I currently have addresses the issues that were created in the responsive design. The two order tables and the order panel are all in a flex row (orders-left), and the height of the row depends on the largest column in the row. As more rows are added to buy/sell order tables, the entire row expands. Instead, what we want is the buy/sell order tables to depend on the height of the order panel. This is the same relationship the userorders div has to orders-left.

The userorders div has the fill-abs class and a minimum height, so on large screens its height depends on the height of orders-left and on smaller screens it has the minimum height. What I have now for the buy/sell tables is the same, except on large screens it has the same properties as fill-abs and on smaller screens it just has a max-height. The benefit of this is that it avoids additional space when there are very few rows (this shouldn't matter in practice).

I will update userorders to use a max height instead of a min height as well.

Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

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

Tried all the sizes and configurations I could think of on firefox and looks fine.

@chappjc
Copy link
Member

chappjc commented Aug 19, 2021

What I currently have addresses the issues that were created in the responsive design. The two order tables and the order panel are all in a flex row (orders-left), and the height of the row depends on the largest column in the row. As more rows are added to buy/sell order tables, the entire row expands. Instead, what we want is the buy/sell order tables to depend on the height of the order panel. This is the same relationship the userorders div has to orders-left.

The userorders div has the fill-abs class and a minimum height, so on large screens its height depends on the height of orders-left and on smaller screens it has the minimum height. What I have now for the buy/sell tables is the same, except on large screens it has the same properties as fill-abs and on smaller screens it just has a max-height. The benefit of this is that it avoids additional space when there are very few rows (this shouldn't matter in practice).

^^ Thanks for this. Going forward, this kind of description is desirable for the git commit messages, for the purposes of assisting review by describing the root cause of the issue and the approach used to fix it, and to express the intent of the code changes for posterity.

@martonp
Copy link
Contributor Author

martonp commented Aug 23, 2021

@chappjc What do you mean? Should I copy this to the description of the PR?

@chappjc
Copy link
Member

chappjc commented Aug 23, 2021

I'm referring to the git commit messages. So instead of a one sentence like "Add vscroll to buy/sell order tables." or "Update.", you'd describe the change like you did well in that github comment. No need to update anything now though, just going forward.

When I merge the PR I will squash down and describe the change in terms of what was done to restore the vscroll, why it was broken, and any other improvements. So ideally the git commit messages would already have this done.

@chappjc chappjc changed the title ui: add vscroll to buy/sell orders tables. ui: restore vscroll to buy/sell orders tables Aug 23, 2021
right: 0;
}

@media (max-width: 991px) {
Copy link
Member

@chappjc chappjc Aug 23, 2021

Choose a reason for hiding this comment

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

I feel like there should be a way to use the breakpoints defined in application.scss, no? Like @media-breakpoint-down(md) and @media-breakpoint-up(lg) mixins instead of these @media(min/max...) lines

$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,

If doing so makes things more complex, then this is fine, but it seems a bit fragile because we risk changing one but not the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With @media-breakpoint-down and @media-breakpoint-up that are different from what we are using, but what I have now has the same effect.

@media (min-width: 992px) {
$lg: map.get($grid-breakpoints, "lg");

@media (max-width: calc(#{$lg} - 1px)) {
Copy link
Member

@chappjc chappjc Aug 24, 2021

Choose a reason for hiding this comment

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

Bummer the mixin wasn't quite right. I'm still uncertain why it wouldn't fit the bill here though. Basically the "docs" at https://mdbootstrap.com/docs/standard/layout/breakpoints/ and the code in node_modules/bootstrap/scss/mixins/_breakpoints.scss indicate it's doing basically what you're doing except with a - 0.02 instead of - 1 for the media-breakpoint-down impl, which does still sound appropriate.

Copy link
Contributor Author

@martonp martonp Aug 24, 2021

Choose a reason for hiding this comment

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

The $grid-breakpoints variable that we are using in application.scss is different from the one in bootstrap. The xxl size we have is 1750px instead of 1400px. The lg size is the same but I think it's better to be consistent.

Copy link
Member

@chappjc chappjc Aug 24, 2021

Choose a reason for hiding this comment

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

Ok, I see your concern now. But the map we define in application.scss seems to override the one in bootstrap's _variables.scss. This seems to be on account of the use of the SASS !default flag (https://sass-lang.com/documentation/variables#default-values)

https://github.com/twbs/bootstrap/blob/6ffb0b48e455430f8a5359ed689ad64c1143fac2/scss/_variables.scss#L195-L201

With the mixin:

image

image

Copy link
Member

@chappjc chappjc Aug 24, 2021

Choose a reason for hiding this comment

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

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 issue was that I was using the same size in both the up and down case, not that it was using the incorrect variable. It's fixed now.

Copy link
Member

@chappjc chappjc Sep 30, 2021

Choose a reason for hiding this comment

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

Just making a note that when we update to Bootstrap 5, there's a breaking change we might not catch:

Media query mixins parameters have changed for a more logical approach.

  • media-breakpoint-down() uses the breakpoint itself instead of the next breakpoint (e.g., media-breakpoint-down(lg) instead of media-breakpoint-down(md) targets viewports smaller than lg).
  • Similarly, the second parameter in media-breakpoint-between() also uses the breakpoint itself instead of the next breakpoint (e.g., media-between(sm, lg) instead of media-breakpoint-between(sm, md) targets viewports between sm and lg).

https://getbootstrap.com/docs/5.0/migration/#utilities

@chappjc chappjc merged commit 499ab0d into decred:master Aug 24, 2021
@martonp martonp deleted the ordersVscroll branch December 20, 2022 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a vscroll for Buy/Sell Orders tables
4 participants