Skip to content

MudTable/MudDataGrid: Fix row background color for mobile view.#7306

Merged
henon merged 1 commit intoMudBlazor:devfrom
KBM-Kevin-Kessler:fix/table-row-color-in-mobile-view
Sep 9, 2023
Merged

MudTable/MudDataGrid: Fix row background color for mobile view.#7306
henon merged 1 commit intoMudBlazor:devfrom
KBM-Kevin-Kessler:fix/table-row-color-in-mobile-view

Conversation

@KBM-Kevin-Kessler
Copy link
Contributor

@KBM-Kevin-Kessler KBM-Kevin-Kessler commented Aug 5, 2023

Description

This PR fixes a CSS issue for the MudTable and MudDataGrid, which prevents to apply any background color to the rows and cells, when the table is in mobile view.
See MudTable example "Click Event and display for selected Row" utilizing RowClassFunc and reduce width to trigger Mobile View:
MudTable

See MudDataGrid example "Advanced Data Grid", enable hover and striped, change to dark mode (to see striped, default striped color in light mode seem not different), compare with MobileView:
MudDataGrid

Resolve #4468

What changed in the code

I changed the styles.scss and replaced "display: initial" with display: revert" for the .mud-table-row class (for small devices).

"display: revert" is supported by all Browsers since April 2021. MDN

"display: revert" changes the display back to it's default value for the element, which is table-row.

"display: initial" changed the display to inline, which caused the error.

I could remove the display property totally from the class, which works also, but I was not sure if this would lead to a breaking change, if the display is set on a parent element. That's why I chose to use "display: revert" instead to avoid a breaking change.

Screenshots before:

Normal View

Here you can see how it looks in selected state, and hover, when using the RowClassFunc to change background color.
image

Mobile View

Here you can see, how the selected element (2nd) does not have a different background color, only a different font color (white).
Also the hovered and striped items does not have a different background color.
image

Screenshots after:

Mobile View

Here you can see the selected using the RowClassFunc row.
image

Here you can see the striped rows and hovered row (3rd row)
image

How Has This Been Tested?

I run all unit tests.
I run WASM Host and visually checked on MudDataGrid and MudTable if the striped and hover color works in mobile view. On MudTable I cheked the example, which changes the background color. Now it looks like expected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels Aug 5, 2023
@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.55% ⚠️

Comparison is base (1605ea0) 91.17% compared to head (7c30517) 90.62%.
Report is 250 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7306      +/-   ##
==========================================
- Coverage   91.17%   90.62%   -0.55%     
==========================================
  Files         392      427      +35     
  Lines       14836    15152     +316     
==========================================
+ Hits        13527    13732     +205     
- Misses       1309     1420     +111     

see 204 files with indirect coverage changes

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

@KBM-Kevin-Kessler
Copy link
Contributor Author

@henon Can someone review this PR to fix this bug? It would be nice if it works correctly in my application.

@henon
Copy link
Contributor

henon commented Sep 8, 2023

Ok, this is simple enough. I take it you checked with your fix on desktop as well?

@KBM-Kevin-Kessler
Copy link
Contributor Author

Hi henon, thanks for the reply.
I tested following browsers and everywhere it looked good:

Desktop Windows:

  • Edge
  • Chrome

On Android Mobile:

  • Samsung Internet
  • Chrome

On iPad / iOS:

  • Safari

@henon henon merged commit 91ebd58 into MudBlazor:dev Sep 9, 2023
@henon
Copy link
Contributor

henon commented Sep 9, 2023

Thanks @KBM-Kevin-Kessler

@ScarletKuro
Copy link
Member

Thanks @KBM-Kevin-Kessler. Don't hesitate in future to ping the members more early, because we do miss PR sometimes.

@KBM-Kevin-Kessler
Copy link
Contributor Author

Hey @ScarletKuro. Thanks for letting me know. I was kind of scared it would be rude to do. You probably have a lot of other issues and pull requests to handle, which are more important.
I'm already looking forward for the next time. Maybe something little bit more complex. 😀

ilovepilav pushed a commit to ilovepilav/MudBlazor that referenced this pull request Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual bug in example table - Click Event and display for selected Row

3 participants