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

Remove overrides of PopIn/PopOut in FocusedOverlayContainer #5834

Merged
merged 5 commits into from Jun 12, 2023

Conversation

jai-x
Copy link
Member

@jai-x jai-x commented Jun 11, 2023

Resolves #5621

Moves focus logic outside of PopIn/PopOut methods in FocusedOverlayContainer

Forces non-abstract inheritors of FocusedOverlayContainer to correctly implement these methods.

Breaking changes

Subclasses of FocusedOverlayContainer must now implement Pop{In,Out}()

Previously, subclasses of FocusedOverlayContainer were not forced to implement Pop{In,Out} themselves, despite actually needing to do so for the overlay to actually play transitions out correctly. This has now been changed and inheritors of the class must always implement Pop{In,Out}.

In practice this should not break any reasonable consumers of the class, except for the need to remove any base.Pop{In,Out}() calls in classes that directly inherit FocusedOverlayContainer and call base in Pop{In,Out}().

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 11, 2023
Comment on lines +22 to +33
public abstract partial class Popover : OverlayContainer
{
protected override bool BlockPositionalInput => true;

public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Body.ReceivePositionalInputAt(screenSpacePos) || Arrow.ReceivePositionalInputAt(screenSpacePos);

public override bool HandleNonPositionalInput => State.Value == Visibility.Visible;

public override bool RequestsFocus => State.Value == Visibility.Visible;

public override bool AcceptsFocus => State.Value == Visibility.Visible;

Copy link
Member Author

@jai-x jai-x Jun 11, 2023

Choose a reason for hiding this comment

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

This is a bit of an odd change.

Since PopOver was overriding PopIn/PopOut and FocusedOverlayContainer used those methods for automatic getting focus, it meant that PopOver would never automatically gain focus when shown.

Since moving the focus gain to UpdateState in FocusedOverlayContainer, this changed the focus behaviour of PopOver and broke tests.

The solution here is to not inherit from FocusedOverlayContainer and allow PopOver to manage it's own focus state.

@peppy peppy self-requested a review June 12, 2023 04:39
Copy link
Sponsor Member

@peppy peppy left a comment

Choose a reason for hiding this comment

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

Looks logical

@peppy
Copy link
Sponsor Member

peppy commented Jun 12, 2023

osu! side changes: ppy/osu#23882

Will wait for one more review on this one.

peppy added a commit to peppy/osu that referenced this pull request Jun 12, 2023
@bdach bdach self-requested a review June 12, 2023 15:17
Copy link
Collaborator

@bdach bdach left a comment

Choose a reason for hiding this comment

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

Seems sane

@bdach bdach enabled auto-merge June 12, 2023 15:40
@peppy peppy disabled auto-merge June 12, 2023 17:28
@peppy peppy merged commit ca4c1e0 into ppy:master Jun 12, 2023
20 checks passed
peppy added a commit to peppy/osu that referenced this pull request Jun 16, 2023
peppy added a commit to ppy/osu that referenced this pull request Jun 17, 2023
peppy added a commit to peppy/osu that referenced this pull request Jun 17, 2023
peppy added a commit to peppy/osu that referenced this pull request Jun 18, 2023
@jai-x jai-x deleted the focused-overlay-pop-in-out branch June 18, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FocusedOverlayContainer makes PopIn/PopOut optional despite requiring implementation
3 participants