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

Possible documentation clarification: Type selectors won't see import aliases #1254

Closed
davep opened this issue Nov 23, 2022 · 2 comments
Closed
Labels
documentation Improvements or additions to documentation

Comments

@davep
Copy link
Contributor

davep commented Nov 23, 2022

I wonder if it's worth adding a note/warning/something to the documentation, when dealing with type selectors, to the effect that something like this won't work:

from textual.app import App, ComposeResult
from textual.widgets import Label as MyLabel

class AliasTest( App[ None ] ):

    CSS = """
    MyLabel {
        text-style: bold;
        color: yellow;
        background: red;
    }
    """
    def compose( self ) -> ComposeResult:
        yield MyLabel( "This is a very important heading" )

if __name__ == "__main__":
    AliasTest().run()

Textual's CSS isn't going to see the alias of Label being MyLabel. I could see this being a little gotcha that might trip someone up.

@davep davep added the documentation Improvements or additions to documentation label Nov 23, 2022
@willmcgugan
Copy link
Collaborator

Good point, but AFAIK it is not a common error. Unless devs are tripping up on that I think we can leave it.

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
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants