Skip to content

Conversation

@rodrigogiraoserrao
Copy link
Contributor

This fixes #2772 by blurring the focused widget if it is a descendant of the widget that was disabled.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

Copy link
Member

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can save a few cpu cycles here.

if (
self.disabled
and self.app.focused is not None
and self.app.focused in self.walk_children()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is somewhat inefficient to walk the DOM every time something is disabled.

How about we just check if self.app.focused is disabled or has a disabled ancestor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 as in a45b156?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that looks right to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the tests don't like it. Why does this require a screen on the stack..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willmcgugan I'd say you have to check if the optimisation is worth the extra mess created to handle the cases where the disabled status is set outside the context of a running app.

Related comments: #2776 (comment)
@willmcgugan willmcgugan merged commit 118e62d into main Jun 14, 2023
@willmcgugan willmcgugan deleted the disabled-container branch June 14, 2023 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shouldn't be able to type in to a disabled input

3 participants