Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/changes/searchbox_fixes_2017-04-24-09-53.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Searchbox: IE11 keystroke miss, overflow fix",
"type": "patch"
}
],
"email": "manishda@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
font-size: inherit;
color: $ms-color-black;
background-color: transparent;
flex-grow: 1;
flex: 1 1 0;
overflow: hidden;
text-overflow: ellipsis;
// This padding forces the text placement to round up.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class SearchBox extends BaseComponent<ISearchBoxProps, ISearchBoxState> {

private _rootElement: HTMLElement;
private _inputElement: HTMLInputElement;
private _latestValue: string;

public constructor(props: ISearchBoxProps) {
super(props);
Expand All @@ -39,6 +40,7 @@ export class SearchBox extends BaseComponent<ISearchBoxProps, ISearchBoxState> {

public componentWillReceiveProps(newProps: ISearchBoxProps) {
if (newProps.value !== undefined) {
this._latestValue = newProps.value;
this.setState({
value: newProps.value
});
Expand Down Expand Up @@ -67,6 +69,7 @@ export class SearchBox extends BaseComponent<ISearchBoxProps, ISearchBoxState> {
className={ css('ms-SearchBox-field', styles.field) }
placeholder={ labelText }
onChange={ this._onInputChange }
onInput={ this._onInputChange }
onKeyDown={ this._onKeyDown }
value={ value }
ref={ this._resolveRef('_inputElement') }
Expand Down Expand Up @@ -136,10 +139,14 @@ export class SearchBox extends BaseComponent<ISearchBoxProps, ISearchBoxState> {

@autobind
private _onInputChange(ev: React.ChangeEvent<HTMLInputElement>) {
this.setState({
value: this._inputElement.value
});
this._callOnChange(this._inputElement.value);
const value = this._inputElement.value;
if (value === this._latestValue) {
return;
}
this._latestValue = value;

this.setState({ value });
this._callOnChange(value);
}

private _handleDocumentFocus(ev: FocusEvent) {
Expand Down