Skip to content

Blazor FocusAsync coverage#20236

Merged
guardrex merged 17 commits intomasterfrom
guardrex-patch-1
Oct 22, 2020
Merged

Blazor FocusAsync coverage#20236
guardrex merged 17 commits intomasterfrom
guardrex-patch-1

Conversation

@guardrex
Copy link
Copy Markdown
Collaborator

@guardrex guardrex commented Oct 20, 2020

Fixes #20232
Fixes #20195

@guardrex guardrex requested a review from captainsafia October 20, 2020 14:22
Comment thread aspnetcore/blazor/call-javascript-from-dotnet.md Outdated
Comment thread aspnetcore/blazor/call-javascript-from-dotnet.md Outdated
@guardrex
Copy link
Copy Markdown
Collaborator Author

guardrex commented Oct 21, 2020

@captainsafia I was trying not to change Javier's lingo too much, but I agree with you. It's much better to just rewrite it to avoid the versioning altogether. Also, it was 😵 half-baked 😵 ... I didn't have all of the focus event-based example converted over to a click-based event example, which is necessary now that Blazor has a nice way to focus things without custom JS interop.

Also, I think prefixing objects/members with my isn't so hot. I'm still playing with a general naming approach to avoid my, but perhaps example as a prefix is good (e.g., myInput 👉 exampleInput, mybutton 👉 exampleButton) ... it's on this PR to see how it composes. If you have a better idea, I'm all 👂👂👂.

@guardrex
Copy link
Copy Markdown
Collaborator Author

guardrex commented Oct 21, 2020

Also @captainsafia ... one more little thing that we can put on here for issue #20195.

@mrlife inquired on the "guarantee" in the reasoning for not being able to pass element references between components. I think what that "guarantee" means is that the element reference doesn't exist until the component is rendered ... therefore ... that late in rendering the component ... nothing can be passed as a parameter. Thus (along with being a struct), the guidance is to use a callback.

I change that text here on the last commit to try and fix up the "guarantee" lingo to explain it that way. See if that update makes sense to u.

@mrlife, please review that last commit.

ADDITIONAL: I'm going to make one more little update to the struct remark. See if that works, too.

Copy link
Copy Markdown
Contributor

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

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

Looking pretty good!

Tangentially: do we have docs on our updated IJSObjectReference stuff?

Comment thread aspnetcore/blazor/call-javascript-from-dotnet.md Outdated
Comment thread aspnetcore/blazor/components/event-handling.md Outdated
Comment thread aspnetcore/blazor/components/event-handling.md Outdated
Comment thread aspnetcore/blazor/call-javascript-from-dotnet/samples_snapshot/component1.razor Outdated
Comment thread aspnetcore/blazor/call-javascript-from-dotnet/samples_snapshot/component1.razor Outdated
Comment thread aspnetcore/blazor/call-javascript-from-dotnet.md Outdated
@guardrex
Copy link
Copy Markdown
Collaborator Author

@captainsafia

do we have docs on our updated IJSObjectReference stuff?

Yes ... it's in the 5.0 version of the doc at ...

https://docs.microsoft.com/en-us/aspnet/core/blazor/call-javascript-from-dotnet?view=aspnetcore-5.0#blazor-javascript-isolation-and-object-references

... also mentioned here (and Pranav said this is enough here, i.e., we don't need an example for this mention) ...

https://docs.microsoft.com/en-us/aspnet/core/blazor/webassembly-performance-best-practices?view=aspnetcore-5.0#consider-making-synchronous-calls

Co-authored-by: Safia Abdalla <safia@microsoft.com>
@guardrex
Copy link
Copy Markdown
Collaborator Author

🙈😄

await exampleInput.FocusAsync();

"FocusAsync" ....... Async!! .... await .... Geebers McScreebers! 😄

One of these days, I'll learn how to do async. Not today, of course! ... but one day. 😁

@guardrex
Copy link
Copy Markdown
Collaborator Author

@captainsafia ... I committed ur updates. I think we're good here. This won't go live until later today/tonight, so we have time to sneak another PR in if needed.

@guardrex guardrex merged commit 453b2e9 into master Oct 22, 2020
@guardrex guardrex deleted the guardrex-patch-1 branch October 22, 2020 11:11
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.

Blazor FocusAsync ElementReference Validity

2 participants