-
Notifications
You must be signed in to change notification settings - Fork 273
ui5-shellbar/ui5-input support instructional popover #1590
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
Comments
Hello @codefactor The ui5-input has slot called "valueStateMessage", it is a message that is displayed in a popover underneath the input field and you can pass arbitrary content to that slot like the instructions from the image. In addition, you have to set value-state="Information", because the "valueStateMessage" shows whenever the ui5-input has value-state "Error", "Warning" or "Information". <ui5-input value-state="Information" slot="searchField" show-suggestions>
<div slot="valueStateMessage">Instructions go here</div>
</ui5-input> The difference would be the light blue background-color of the popover. Perhaps you can give it a try and see if it is an acceptable solution. Best, |
I tried this - it seems close to a good solution but not quite right. When I press the "Search" button to activate the search input for the first time, the popover does not show up right away. It does show up, though, if I click back onto the input field a second time. Could that be a bug? |
Also - another thing is that after the user types something - the message is not being removed. I guess I would need to remove the instructional text if there are any search results currently being displayed. |
I solved the issue about the instructions showing up after search results are displayed by changing the "value-state" prop of the to "None" when the message is not supposed to show. For the first issue - if you would like to experiment with my implementation and see the issue - you can try out the following repo:
Expected: Actual: NOTE: The instructional text snippet is not properly styled yet and the SAP Icon Font is not loaded, please ignore that part |
Hi @codefactor I cloned the repo and I was able to reproduce it. I think it is a timing issue, related to how and when we focus the input field. Look at the following logic within our code (Shellbar.js) // ShellBar.js
// The ShellBar uses a timeout to focus the input
// to ensure the input is displayed and ready to be focused
setTimeout(() => {
const inputSlot = searchField.children[0];
if (inputSlot) {
inputSlot.assignedNodes()[0].focus();
}
}, 100); However, in your case, the timeout executes too late. First, the input checks if it should show a valueStateMessage and one of the requirements is to be on focus, which is still false (the timeout is called later) and does not show anything. Using some number, 100 in this case, is not a reliable way, so we have to handle the focus differently. Thanks for reporting. Best, |
**Issue**: the valueStateMsg popover does not show up when the user clicks on the search icon. **Root cause**: the ShellBar uses a timeout to focus the input to ensure it is displayed and ready to be focused, but sometimes the timeout executes too late. - First, the Iinput checks (onAfterRendering) if it should show a valueStateMessage and one of the requirements is to be on focus, which is still false (the timeout is called later) and does not show the popover. - Then, the timeout is called, moves the focus to the input, but it does not trigger re-rendering and the popover does not show up. **Solution:** update the state (Input "focused" property) immediately, keep the focus move delayed. Fixes: #1590
Is your feature request related to a problem? Please describe.
The current UI5 search on successfactors headers supports instructional popover, this would be nice to have a solution in WCHeader.
Describe the solution you'd like
Some kind of slot for an instructional text to be displayed before the user starts typing anything.
Describe alternatives you've considered
None yet.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: