Skip to content

WIP add steplist componente - #2832

Closed
razvanip wants to merge 4 commits into
adobe:mainfrom
razvanip:enhancement_1012-steplist
Closed

WIP add steplist componente#2832
razvanip wants to merge 4 commits into
adobe:mainfrom
razvanip:enhancement_1012-steplist

Conversation

@razvanip

Copy link
Copy Markdown
Contributor

Closes

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

I took the great work @itaylor did on step list and did some of the changes that were discussed like:

  • changed aria hooks to fallow same pattern, like the rest of the components passing props state ref to get the components DOM props
  • added keyboard delegation for useStepList currently it's the same like for tabs but i will fallow with spectrum design to get the corect keyboard navigation behaviour
  • added support for useSelectableCollection in useStepList
  • moved aria-${props} out of useStepItem to StepItem to fallow the same pattern with the rest of the components

My Plan:

  • revisit styling and make sure we are aligned with UX
  • address some comments from @snowystinger regarding flex
  • add docs
  • refactor stories and add more examples

Let me know your thoughts

"@react-aria/link": "^3.2.0",
"@react-aria/selection": "^3.7.1",
"@react-aria/tabs": "^3.1.0",
"@react-aria/utils": "3.4.1",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

any reason for the fixed version ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

your editor probably did it, it happens to me sometimes, it should be a range

@@ -0,0 +1,67 @@
{
"name": "@react-spectrum/steplist",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

revisit deps, we don't need all 4 sure

"@spectrum-icons/ui": "3.2.0"
},
"devDependencies": {
"@adobe/spectrum-css-temp": "^3.0.0-alpha.1"

@razvanip razvanip Feb 10, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bump version to alpha in pkg

@snowystinger snowystinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Took a very quick peek at a couple files, by no means an exhaustive review

margin-right: -10px;
}
.spectrum-Steplist-chevron {
&.is-reversed {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be able to make use of [dir=ltr] & [dir=rtl] instead of adding a class

/* Focus */
&:focus,
&.is-focused,
*:focus {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this selector terrifies me, what's going on or why do we need to select everything?
I think we only use the class now, shouldn't need :focus selectors

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah true, haven't revised the css yet

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It has been a while since I worked on this, but I'm pretty sure that I brought that over from spectrum-css directly without taking the time to investigate why it had so many different ways to select focused elements.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, I'm pretty much assuming these are coming from spectrum-css, we have similar things all over the place that we're slowly cleaning up. Though if you're able to answer why there is a star selector, that'd be really helpful. Otherwise I'll investigate it at some point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'll look over the css and clean it up a little 👍

/* Override last-child bits */
margin-right: 0;
margin-left: calc(calc(var(--spectrum-steplist-marker-hitArea) / 2) * -1);
grid-area: chevron;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if there is no chevron in vertical, let's rename the grid area to be more meaningful

* The ref attached to the element representing the collection.
*/
ref: RefObject<HTMLElement>,
ref: RefObject<HTMLElement | HTMLOListElement>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

HTMLOListElement should be an HTMLElement, I don't think we need this 'or'?

let [lastCompletedStep, setLastCompletedStep] = useControlledState<Key>(props.lastCompletedStep, props.defaultLastCompletedStep, props.onLastCompletedStepChange);
const {setSelectedKey: realSetSelectedKey, selectedKey, collection} = state;
const {prevKeyMap, indexMap} = useMemo(() => buildKeysMaps(collection), [collection]);
const disabledKeys = useMemo(() => new Set(props.disabledKeys), [props.disabledKeys]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure if disabledKeys should fallow same approach as tabs breadcrumbs ... it feels weird to me that if step 3 is disabled user can still navigate to 4-5-6.... since i feel steps should be completed in sequence, i fallowed up with design on this one. If someone has more info on this pls feel free to share.

@dannify dannify mentioned this pull request Mar 3, 2022
5 tasks
@dgrossen dgrossen mentioned this pull request Oct 4, 2023
5 tasks
@dgrossen dgrossen mentioned this pull request Oct 4, 2023
5 tasks
@snowystinger

Copy link
Copy Markdown
Member

Closing for this #5201

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.

4 participants