fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[SearchBox][FeatureRequest]Request to add 'setSelectionRange' public function to ISearchBox interface

Open fengyue1013 opened this issue 9 years ago • 4 comments

In some cases, when searchBox is mounted with predefined value, and needs to be focused (manually call searchBoxRef.focus() or by using FocusTrapZone). The cursor in SearchBox is set to the beginning. See this simple codpen demo.

To controll the selection range, could we public APIs like setSelectionRange(), setSelectionStart(), setSelectionEnd() to ISearchBox? AFAIK, the TextField component has such functions in ITextField

fengyue1013 avatar Sep 14 '17 03:09 fengyue1013

We've talked many times about SearchBox extending the TextField component as they share a LOT of functionality like this. Though TextField is a bit too opinionated about styles, and SearchBox would have to override a ton of them.

We might want to abstract the common functionality out into another component and let TextField and SearchBox be a styled implementation of that component, like we do with BaseButton and the various styled buttons.

Sadly, TextField is a great name for that base component. Maybe we'd call the base TextInput, or BaseTextField.

I.E. I'd rather not keep copying functionality between two components. Let's focus on uniting them.

micahgodbolt avatar Sep 19 '17 15:09 micahgodbolt

@micahgodbolt Totally agree with you!

fengyue1013 avatar Sep 28 '17 02:09 fengyue1013

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Fabric React!

stale[bot] avatar Apr 11 '18 09:04 stale[bot]

This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Fabric React! Why am I receiving this notification?

stale[bot] avatar May 18 '18 21:05 stale[bot]