Skip to content

TextArea modal crashes: KeyError 'text-area--gutter' in apply_css (8.2.x) #6528

Description

@dirkpetersen

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 <8 as a stop-gap (dirkpetersen/maude@2716297).
  • Looks like a TextArea component-class declaration was removed (or renamed) without updating _text_area_theme.apply_css. Adding text-area--gutter (and the other text-area--* names referenced in apply_css) to TextArea.COMPONENT_CLASSES, or guarding the lookups with try/except KeyError, should both work.

Activity

  1. github-actions commented on May 10, 2026

    @github-actions

    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

  2. dirkpetersen commented on Jul 7, 2026

    @dirkpetersen
    Author

    This issue only shows up in version 8.2.3 so my requirements.txt has now : textual>=8.2.4,<9

  3. github-actions commented on Jul 7, 2026

    @github-actions

    I hope I solved your issue!

    Consider sponsoring my work to continue to maintain and develop Textual.

    • Will McGugan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions