Fixed chat send history functionality in Firefox and Edge #1956
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1948
Currently, in the Send History Sample, there is a conditional checking if the send box text input's selection start is positioned at index 0. If it is, the user can navigate through their previous messages; otherwise, the chat history functionality is not accessible.
When the send box value is set from history in Chrome the cursor is placed at the begin of the string; however, it is placed at the end of the string in Firefox and Edge. Consequently,
target.selectionStart === 0
will be true in Chrome after the text input value is set, but not in the other two browsers. Thus, if the user wanted to toggle through the chat history in Firefox or Edge, they would have to place the cursor at the beginning of the string after they press the up arrow sincetarget.selectionStart === 0
would be false.The conditional is intended to prevent users from toggling through the chat history if they are already typing a message; however, the
isDirty
state property already tracks if the user has typed something into the send box. Removing the condition allows users to toggle through the messages in Firefox and Edge and does not affect the rest of the sample's functionality.