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

CSS pseudo selectors #650

Closed
willmcgugan opened this issue Aug 6, 2022 · 7 comments
Closed

CSS pseudo selectors #650

willmcgugan opened this issue Aug 6, 2022 · 7 comments
Labels
enhancement New feature or request europython Task

Comments

@willmcgugan
Copy link
Collaborator

We should implement more pseudo selectors in Textual.

It will be really nice in combination with queries, for instance to remove the last child in a list:

self.query(".item:last-child").remove()

And of course for general styling.

I'm thinking of last-child and first-child, but we could implement any that make sense.

See https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes for a list of pseudo selectors.

@tusharsadhwani
Copy link
Contributor

I'd really recommend the :nth-child selector, and if you decide to implement it, this short video on selecting a range of elements would be a great test for whether it works according to spec:

https://youtu.be/nKLAbYQHnt8

@tusharsadhwani
Copy link
Contributor

I'm not sure if :nth-of-type makes sense or is even viable in textual, but if it is, that'd also be extremely powerful

@davep davep added Task enhancement New feature or request labels Jan 11, 2023
@willmcgugan
Copy link
Collaborator Author

Europython spriters: this may be a challenging one. Mention me if you need assistance.

@rodrigogiraoserrao rodrigogiraoserrao changed the title CSS psuedo selectors CSS pseudo selectors Jul 22, 2023
@csernazs
Copy link

hi there, I'm from EuroPython and I would like to take this issue.

@willmcgugan
Copy link
Collaborator Author

Good luck!

csernazs added a commit to csernazs/textual that referenced this issue Jul 23, 2023
csernazs added a commit to csernazs/textual that referenced this issue Jul 23, 2023
@willmcgugan
Copy link
Collaborator Author

Assuming this is stale. Will revisit psuedo selectors at some point in the future.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request europython Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants