-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Implement RichSuggestBox #3650
Implement RichSuggestBox #3650
Conversation
Thanks huynhsontung for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌 |
|
Thanks @huynhsontung for the PR! Can you please run the UpdateHeaders.bat or '.\build.ps1 -target=UpdateHeaders' and commit the changes? This should get to the next stage in the CI to ensure everything can build and setup a preview package folks can more easily test out. I've put this in the 7.1 milestone for now, so it may take us a bit of time to get to reviewing in more depth. |
@huynhsontung I'm not sure what happened with your Update Headers but it touched like every file in the toolkit... Can you revert the head of your branch, re-commit only the required headers and force-push back? Thanks! There's also some StyleCop issues to resolve, see: https://dev.azure.com/dotnet/WindowsCommunityToolkit/_build/results?buildId=44049&view=logs&j=4a47a688-b50e-58f6-4d2c-6d1b829fc8e2&t=503927fd-5045-588b-b5d5-40c5f89cda06&l=10755 |
@michael-hawker I was wondering why the script changed every file in the repo. Does the script check for line ending? I might have auto CRLF misconfigured. I will resolve all the StyleCop issues at once. |
5ace970
to
c7894bb
Compare
@michael-hawker I have resolved all the build issues. I also added a sample page for easy testing. Let me know what you think. Features still need to be worked on at the moment:
|
@huoyaoyuan I can see that this PR is still being worked on but I have tried testing the sample and I have noticed that whenever the text in the field is highlighted from right to left, part of the font box cuts off. Again I know this might not be the final version but just wanted to provide some feedback before the PR is ready to be tested. |
Thanks @huynhsontung for fixing up the issues so a build passes the CI! It makes it a lot easier for folks to pull down and play with! We're still heads-down on wrapping our 7.0 release at the moment, so it might take me a bit of time to dive in for more detailed feedback. I'm excited to check this control out though! 🙂 In the meantime it seems @Kyaa-dost has been helping to check things out, so let us know when your remaining issues are cleared up and he can help validate them as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huynhsontung starting to get back into things now that we've shipped 7.0. Haven't dug too deep into this yet, but have a couple of quick initial comments. It also has to be moved to the Input folder/project now that we've split up the controls package (basically fast-forward to our current changes). Maybe easiest to rebase?
We should probably think a bit about how we could test this type of control as well. We'll be trying to figure out in the next couple of weeks how we manage the bar for tests and have different avenues based on that. Should know more soon to share, but just wanted to give you a heads up.
Excited to test this out more as it's certainly an experience commonly seen on the web and in many social apps these days! 🎉
Microsoft.Toolkit.Uwp.UI.Controls/RichSuggestBox/RichSuggestBox.cs
Outdated
Show resolved
Hide resolved
Microsoft.Toolkit.Uwp.UI.Controls/RichSuggestBox/RichSuggestBox.xaml
Outdated
Show resolved
Hide resolved
@michael-hawker thank you for letting me know. As I have been incredibly busy lately, I won't be able to work on these changes for the next week or two. I will definitely look into it soon after 🚀 |
7c4c2af
to
2f17dcc
Compare
@michael-hawker I have moved the control to the Input project. Following up on your comments, I unregistered all events before registering and referenced WinUI style directly instead of using a copy. I also discovered some behaviors of Regarding testing, I have not had much experience with UI testing myself. Will be interesting to know more about how WCT tests UI. |
As partially outlined in the issue, there are some shortcomings with the current
That being said, I am pretty happy with how |
@huynhsontung are the unit tests running locally for you? Seems like one of the TokenizingTextBox tests is suddenly failing in the CI here? Not sure if there's a naming conflict in the style somewhere for the RichSuggestBox? That's the only thing I could think of that could influence the other test? |
Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestBox.xaml
Outdated
Show resolved
Hide resolved
@huynhsontung glad you figured out the issue. Let us know if you need some guidance on writing unit tests or UI Interaction tests (though we're waiting for #4007 to be merged to resolve some issues with that). In the meantime, we'll take a look at the corner cases. They don't seem to be too monumental, but will try it out and provide more feedback. Thanks! |
FYI @huynhsontung I have a PR open with info on our whole testing setup: CommunityToolkit/WindowsCommunityToolkit-wiki#33 let me know if you have any questions. Looks like there's a merge conflict from something now, so it may be good to rebase the PR? |
I have opened a PR for a |
Co-authored-by: Michael Hawker MSFT (XAML Llama) <24302614+michael-hawker@users.noreply.github.com>
Co-authored-by: Michael Hawker MSFT (XAML Llama) <24302614+michael-hawker@users.noreply.github.com>
Last two remaining items I'm aware of are:
|
return !ControlHelpers.IsXamlRootAvailable || element.XamlRoot.IsHostVisible; | ||
} | ||
|
||
var toWindow = element.TransformToVisual(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked up the docs, so looks TransformToVisual(null)
is doing what we want already (getting coordinates from the tree root). You should grab the bounds the same way you did in IsElementInsideWindow
, checking Window.Current null above doesn't seem right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the window position relative to the top left of the screen, not to the tree root. I don't know if I can get absolute screen coordinates without using Window
.
edit: From Window class docs, Window.Current is set for UWP and null for Desktop apps. If Window.Current is null we can just assume the element is on-screen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 21 to 29 in 3401db0
As previously discussed, I have disabled the element on screen check due to not being able to get the screen size in a desktop app ( Tracking issues: |
Hello @michael-hawker! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Thanks so much @huynhsontung for creating this amazing control! It's super exciting to have this experience in the Toolkit now for everyone! 🎉🎉🎉 |
Fixes
Closes #3649
Implement rich suggest text control as discussed in the issue.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
None. The control did not exist before this PR.
What is the new behavior?
'RichSuggestBox' is now a usable control in the
Microsoft.Toolkit.Uwp.UI.Controls
namespace.PR Checklist
Please check if your PR fulfills the following requirements:
Other information
Convenient issue tracker
UIElement.PointerEntered
) are not available.This makes behaviors like showing flyout when hover mouse over the token impossible.Cannot use Tab to select a suggestion due to conflict with the accessibility feature.RichEditBox issues
Below are
RichEditBox
related issues encountered during the development of this control.Link
property from a range might change the range.Link
property can sometimes fail but only when the target text is at the beginning of the document.TextChanging
andSelectionChanging
are invoked after the text has changed.