Skip to content

Commit

Permalink
fix(SelectionList): input text now selected on focus
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #1728
  • Loading branch information
benjamincharity committed Oct 3, 2019
1 parent 5986191 commit cbf4c8e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class SelectionListComponent implements OnInit, OnDestroy {
public states = STATES.slice();

// FormControls
public complexMultipleControl = new FormControl();
public simpleControl = new FormControl();
public complexMultipleControl = new FormControl('');
public simpleControl = new FormControl('');

// Query controls
public complexMultipleQuery$ = new BehaviorSubject('');
Expand Down
2 changes: 2 additions & 0 deletions terminus-ui/selection-list/src/selection-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
[readonly]="isDisabled ? 'true' : null"
(ngModelChange)="querySubject.next($event)"
(blur)="handleInputBlur($event)"
onfocus="this.select()"
#input
/>
</ts-chip-collection>
Expand All @@ -53,6 +54,7 @@
[value]="searchQuery"
(ngModelChange)="querySubject.next($event)"
(blur)="handleInputBlur($event)"
onfocus="this.select()"
#input
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,4 +985,8 @@ describe(`TsSelectionListComponent`, function() {
expect(instance.panel.keyManager.activeItemIndex).toEqual(0);
}));

// TODO: Not currently supported by Jest
// Waiting for https://github.com/jsdom/jsdom/issues/317 to land
test.todo(`should select all existing text when the input is focused`);

});

0 comments on commit cbf4c8e

Please sign in to comment.