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

Fix nth child selector in data grid header #15482

Merged
merged 4 commits into from May 13, 2024

Conversation

appel1
Copy link
Contributor

@appel1 appel1 commented Apr 23, 2024

What does the pull request do?

Attempt at getting nth child selectors to work with data grid column headers.

What is the current behavior?

If you add or remove columns :nth-child and :nth-last-child applies to the wrong element.

What is the updated/expected behavior with this PR?

That nth-child and nth-last-child applies to the expected elements after adding or removing columns.

Fixed issues

Fixes #14695

@timunie
Copy link
Contributor

timunie commented Apr 23, 2024

@appel1 for debugging, you can also use src/Samples/Sandbox. You may need to add a reference to DataGrid project. Just fyi.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047602-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@appel1 appel1 closed this Apr 23, 2024
@appel1
Copy link
Contributor Author

appel1 commented Apr 23, 2024

@timunie Thanks for that, made things easier.

But why was the PR closed when I added another commit to it?

@appel1 appel1 reopened this Apr 23, 2024
@appel1
Copy link
Contributor Author

appel1 commented Apr 23, 2024

Not sure if this is the correct approach, but as far as I can tell it works after these changes.

@appel1 appel1 marked this pull request as ready for review April 23, 2024 21:38
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047608-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@appel1 appel1 changed the title [WIP] Fix nth child selector in data grid header Fix nth child selector in data grid header Apr 24, 2024
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047630-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@appel1 appel1 changed the title Fix nth child selector in data grid header [WIP] Fix nth child selector in data grid header Apr 24, 2024
@appel1
Copy link
Contributor Author

appel1 commented Apr 24, 2024

Realized that taking visibility might be a bad idea. If you change visibility in the selector for example.

I'll check how this is handled elsewhere in Avalonia and update the PR.

I think nth child in CSS counts elements even if they are hidden.

@maxkatz6
Copy link
Member

Yes, nth child does count elements if they are hidden. The same goes with avalonia nth child, IIRC.

@appel1
Copy link
Contributor Author

appel1 commented Apr 25, 2024

What about the hidden DataGridFillerColumn? Should that also be taken into account? So that nth-last-child(1) matches the filler column.

@jmacato
Copy link
Member

jmacato commented Apr 25, 2024

@cla-avalonia recheck

@cla-avalonia
Copy link
Collaborator

cla-avalonia commented Apr 25, 2024

  • All contributors have signed the CLA.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047774-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@appel1
Copy link
Contributor Author

appel1 commented Apr 26, 2024

@cla-avalonia agree

@appel1 appel1 changed the title [WIP] Fix nth child selector in data grid header Fix nth child selector in data grid header Apr 26, 2024
@maxkatz6 maxkatz6 merged commit e4e22ae into AvaloniaUI:master May 13, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing visibility of DataGridColumns causes "DataGridColumnHeader:nth-last-child(1)" to act unexepectedly
6 participants