Repository navigation
Description
Summary
Mounting a TextArea inside a ModalScreen crashes on first render with KeyError: "No 'text-area--gutter' key in COMPONENT_CLASSES". _text_area_theme.apply_css calls get_component_rich_style("text-area--gutter") but TextArea's COMPONENT_CLASSES doesn't declare that name.
Versions
- Textual 8.2.x (latest at time of report)
- Python 3.14
- Ubuntu 24.04 LTS / Ubuntu 26.04 LTS in WSL2 (Microsoft kernel 6.6)
Traceback (truncated to relevant frames)
File ".../textual/widget.py", line 1206, in render_lines
theme.apply_css(self)
File ".../textual/_text_area_theme.py", line 107, in apply_css
gutter_style = get_style("text-area--gutter")
File ".../textual/widget.py", line 1194, in get_component_rich_style
component_styles = self.get_component_styles(*names)
File ".../textual/dom.py", line 618, in get_component_styles
raise KeyError(f"No {name!r} key in COMPONENT_CLASSES")
KeyError: "No 'text-area--gutter' key in COMPONENT_CLASSES"
The mounted widget is a TextArea(id='creds-text', language=None, show_line_numbers=False).
Minimal repro
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.screen import ModalScreen
from textual.widgets import TextArea
class CredsModal(ModalScreen[None]):
CSS = """
#box {
width: 80;
height: 20;
border: heavy white;
}
#ta {
height: 10;
border: solid white;
}
"""
def compose(self) -> ComposeResult:
with Container(id="box"):
yield TextArea("", id="ta", language=None, show_line_numbers=False)
class Demo(App):
def on_mount(self) -> None:
self.push_screen(CredsModal())
if __name__ == "__main__":
Demo().run()Pip install on a clean Python 3.14 environment, run, and the modal blows up on first render.
Workaround
Pin textual<8. Versions 7.x and earlier don't reach the new apply_css code path that requires text-area--gutter.
Notes
- Hit in the wild by users of the Maude WSL sandbox (https://github.com/dirkpetersen/maude) when opening a credentials-entry modal containing a
TextArea. We've pinned<8as a stop-gap (dirkpetersen/maude@2716297). - Looks like a TextArea component-class declaration was removed (or renamed) without updating
_text_area_theme.apply_css. Addingtext-area--gutter(and the othertext-area--*names referenced inapply_css) toTextArea.COMPONENT_CLASSES, or guarding the lookups withtry/except KeyError, should both work.
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon May 10, 2026
We found the following entries in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.
This project is developed and maintained by Will McGugan. Consider sponsoring Will's work on this project (and others).
This is an automated reply, generated by FAQtory
dirkpetersen commentedon Jul 7, 2026
This issue only shows up in version 8.2.3 so my requirements.txt has now : textual>=8.2.4,<9
github-actions commentedon Jul 7, 2026
I hope I solved your issue!
Consider sponsoring my work to continue to maintain and develop Textual.
Fix the two races that keep the suite from passing on CI
Fix the two races that keep the suite from passing on CI
Run the suite and the linters on every pull request (#53)