Skip to content

Commit 2c3fae9

Browse files
Merge pull request #5786 from zZHorizonZz:patch/text-field-picker
PiperOrigin-RevId: 740919690
2 parents ff9ab97 + bad490c commit 2c3fae9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

textfield/internal/text-field.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,23 @@ export abstract class TextField extends textFieldBaseClass {
458458
this.getInputOrTextarea().setSelectionRange(start, end, direction);
459459
}
460460

461+
/**
462+
* Shows the browser picker for an input element of type "date", "time", etc.
463+
*
464+
* For a full list of supported types, see:
465+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker#browser_compatibility
466+
*
467+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker
468+
*/
469+
showPicker() {
470+
const input = this.getInput();
471+
if (!input) {
472+
return;
473+
}
474+
475+
input.showPicker();
476+
}
477+
461478
/**
462479
* Decrements the value of a numeric type text field by `step` or `n` `step`
463480
* number of times.

0 commit comments

Comments
 (0)