Clicking the Header makes it tall, but `Header.tall` stays False
まだ誰も着手していません。
評価
調査の方向性
The header widget lives in src/textual/widgets/_header.py; read _on_click there next to watch_tall, which is what actually applies the -tall class when the reactive changes. Run the snippet from the issue against a checkout to confirm the mismatch, then check the existing header tests (and snapshot tests under tests/) for where to add a regression case. Done means a click sets tall to True and header.tall = False shrinks the header back to one line. Note the reporter says a PR with a test is already prepared, so coordinate before starting.
索引モデルが issue の本文から書いたものです。
説明
Hi! I hit this while writing generated tests against Textual's widgets.
Header._on_click toggles the -tall class directly, rather than the tall reactive that watch_tall uses to set that class. So after a click the header is drawn tall but tall is still False, and header.tall = False does nothing, because the value hasn't changed.
import asyncio
import textual
from textual.app import App, ComposeResult
from textual.widgets import Header
class HeaderApp(App):
def compose(self) -> ComposeResult:
yield Header()
async def main() -> None:
app = HeaderApp()
async with app.run_test() as pilot:
header = app.query_one(Header)
await pilot.pause()
print(f"start: tall={header.tall} height={header.size.height} classes={sorted(header.classes)}")
await pilot.click(offset=(40, 0)) # on the title
await pilot.pause()
print(f"after click: tall={header.tall} height={header.size.height} classes={sorted(header.classes)}")
header.tall = False
await pilot.pause()
print(f"after tall = False: tall={header.tall} height={header.size.height} classes={sorted(header.classes)}")
print("Textual", textual.__version__)
asyncio.run(main())
Output on Textual 8.2.7 (and the same on main at 5e5b7ef):
start: tall=False height=1 classes=[]
after click: tall=False height=3 classes=['-tall']
after tall = False: tall=False height=3 classes=['-tall']
I expected tall=True after the click, and the header to go back to one line after header.tall = False. Toggling the reactive in _on_click (self.tall = not self.tall) gives that, and I have a PR with a test ready if you'd like it.
- 主要言語
- Python
- スター
- 37.7k
- フォーク
- 1.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Textualize/textual のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Textualize/textual#6790 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
Textualize/textual#6789 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Textualize/textual#6787 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Textualize/textual#6782 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
Textualize/textual#6778 · コメント 1 件 ·
Textualize/textual の issue をすべて見る
似ている issue
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskオープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
sandbox-quantum/switch#2163 ·
メンテナーはふだん 1 日以内に返信
-
bug pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
pydantic/pydantic-ai#13939 ·
メンテナーはふだん 1 日以内に返信
-
priority: low python
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
LearningCircuit/local-deep-research#8849 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
francescopace/espectre#223 ·
メンテナーはふだん 3 日以内に返信
-
good first issue Status: Triaged
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
canonical/imagecraft#538 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信