add option to enable / disable autofocus of input when a button is clicked#456
Conversation
|
@macrozone, It will cover your contributions to all Microsoft-managed open source projects. |
|
@macrozone, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
|
|
||
| private doCardAction(type: CardActionTypes, value: string) { | ||
| this.props.setFocus(); | ||
| if(this.props.setFocusOnCardActionClick) { |
There was a problem hiding this comment.
Perhaps this conditional can be moved above
| <MessagePane setFocus={ () => this.setFocus() }> | ||
| <History setFocus={ () => this.setFocus() }/> | ||
| <History | ||
| setFocusOnCardActionClick={this.props.setFocusOnCardActionClick} |
There was a problem hiding this comment.
If we add the conditional here, we won't need the additional property on History
There was a problem hiding this comment.
I also thought about that, but from looking at this piece of code, you don't know whether History might need this.setFocus for someting else. That's why I dediced to use a rather verbose property that does exactly what it says.
|
I'm wary of introducing too many "behave this way" flags into properties. Is there really no best practice on how to handle this? |
|
I have a few ideas on how we might re-implement this feature, can we discuss on the original issue? #363 |
|
@danmarshall the original issue focuses more on desktop interaction, so maybe we should open another issue about the problems on mobile devices. What i would expect as user when clicking on a button (on mobile device):
My option prevents the keyboard from opening, but unfortunatly does not scroll down on button click anymore @billba totally agree, it's a workaround and does not solve the underlying issue (scrolling down while not opening the keyboard) |
|
Hi @macrozone , we are going to revisit how we want to approach the features for autoscroll and focus. I'm going to close this PR for now, but thanks for the contribution! |
|
@macrozone hey I'm new to using bot and I want to disable the autofocus on input. i.e. i don't want the keyboard every time as it takes up too much space and the bot is barely visible. Can you please tell me how i can implement it in my bot. I've created a bot using .Net. |
|
@nupurkamble I forked the project (node.js version) and added this option myself ;-) You will have to wait for the contributors to implement that functionallity. Please follow this issue: #623 |
if a user clicks on a card button, the input get focused, which opens the keyboard on mobile device.
This can be annoying if you use a lot of confirms and choices.
you can now set setFocusOnCardActionClick to false on the
<Chat>-Component to disable this behaviour.The caveat is that the chat no longer scrolls to bottom, when a button is clicked when this option is false.
Feedback welcome!