Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [DRAFT] adds select component #3902

Closed
wants to merge 2 commits into from

Conversation

eljefe223
Copy link
Contributor

Description

Adds select component. Work in progress

Motivation & context

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Adding or modifying component(s) in @microsoft/fast-components checklist

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

@EisenbergEffect
Copy link
Contributor

I'd love to see some screenshots or animated gifs of this in action 😉

@eljefe223 eljefe223 force-pushed the users/jes/select-component branch from 0f93cfb to 9b7c356 Compare September 15, 2020 19:40
@@ -18,14 +18,18 @@ import { Dialog } from '@microsoft/fast-foundation';
import { Direction } from '@microsoft/fast-web-utilities';
import { Divider } from '@microsoft/fast-foundation';
import { Flipper } from '@microsoft/fast-foundation';
import { Listbox } from '@microsoft/fast-foundation';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a seperate pr/spec for listbox if we're calling it the "FAST listbox" which implies it is a generic building block component.

// Don't scroll the page for arrow keys, and spacebar.
e.preventDefault();
switch (e.keyCode) {
case KeyCodes.arrowDown:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling navigation across the options should be handled by the "listbox" component IMO.

private typeAheadTimeoutHandler: number = -1;
private typeAheadExpired: boolean = false;
private static readonly TYPE_AHEAD_TIMEOUT_MS = 1000;
public handleTypeAhead(typedKey) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have type ahead as part of the initial feature set? Seems like an extra. There should be an option to enable/disable it at least.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should look to include basic type ahead here - I don't think we need full combobox behavior.

I'm definitely in favor of this being configurable per @scomea's suggestion. I'd suggest including a property for the timeout itself so that's configurable as well. I know most browsers tend to use 500ms for this from some Open UI research we just discussed over there.

}

public keypressHandler = (e: KeyboardEvent): void => {
console.log('button pressed');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pull the console.logs :)

console.log('button pressed');
switch (e.keyCode) {
case keyCodeSpace:
console.log('space pressed');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pull the console.logs :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should we do in this case? Have we not yet set up our keyboarding behavior of the listbox?


/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
public clickHandler = (e: MouseEvent): void => {
console.log(e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a TODO?


export const OptionTemplate = html<Option>`
<template
tabindex="0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Options can be disabled - I'd expect us to have a tabindex of -1 in that case.

/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
public clickHandler = (e: MouseEvent): void => {
(this.checked) ? this.checked = false : this.checked = true;
this.$emit("oui-option-selection-change");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll want this event to be different - is this a change event?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generic or "selection-change"


export const SelectTemplate = html<Select>`
<template
@oui-option-selection-change="${(x, c) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@change - we should drop all the oui modifiers.

switch (e.keyCode) {
case KeyCodes.space:
this.open = !this.open;
console.log("Call one")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no console

break;
case KeyCodes.enter:
this.open = !this.open;
console.log("Call two")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no console

break;
case KeyCodes.enter:
this.value = this.options[this.activeOptionIndex].value;
console.log("Fire Enter", this.activeOptionIndex)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no console

case KeyCodes.escape:
this.options[this.activeOptionIndex].removeAttribute('current');
this.open = !this.open;
console.log("Call three")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no console

this.updateSelectValue(value);
this.typeAheadValue = '';
this.open = !this.open;
console.log("Call six")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no console please


private applyButtonControllerCode(): void {
if (this.button) {
console.log("This hits", this.button)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no console please

@nicholasrice
Copy link
Contributor

Converting to draft because this is a draft PR.

@nicholasrice nicholasrice marked this pull request as draft September 28, 2020 16:09
@stale
Copy link

stale bot commented Oct 12, 2020

This pull request 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.

@stale stale bot added the warning:stale No recent activity within a reasonable amount of time label Oct 12, 2020
@radium-v
Copy link
Collaborator

stalebot pls

@stale stale bot removed the warning:stale No recent activity within a reasonable amount of time label Oct 12, 2020
@EisenbergEffect
Copy link
Contributor

@radium-v You picked up work on this, yes? Do you need further review of this PR or is it better to wait for your update?

@radium-v
Copy link
Collaborator

@EisenbergEffect I'll have more commits incoming on this soon, should I add it to this PR or create a new one?

@EisenbergEffect
Copy link
Contributor

@radium-v I don't have any strong opinions, so feel free to do whatever works best for your flow.

@chrisdholt
Copy link
Member

@radium-v I don't have any strong opinions, so feel free to do whatever works best for your flow.

@EisenbergEffect @radium-v let's snap a new PR and start fresh.

@radium-v
Copy link
Collaborator

Closing, see #4074.

@radium-v radium-v closed this Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants