-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
chore: add autofill stories #7722
Merged
+73
−0
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2c29f95
chore: add autofill stories
yihuiliao dbaefb1
add more components to form stories
yihuiliao ed46dec
Merge branch 'main' into add-autofill-stories
yihuiliao ec10e2f
make autocomplete form more realistic
yihuiliao 997e74e
rename story
yihuiliao df4ad82
fix lint
yihuiliao 67fd9db
add picker to s2 form story
yihuiliao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright 2022 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
|
||
import {action} from '@storybook/addon-actions'; | ||
import {Button, Form, Input, Label, ListBox, ListBoxItem, Popover, Select, SelectValue, TextField} from 'react-aria-components'; | ||
import React from 'react'; | ||
|
||
export default { | ||
title: 'React Aria Components' | ||
}; | ||
|
||
|
||
export const FormAutoFillExample = () => { | ||
return ( | ||
<Form | ||
aria-label="Shipping information" | ||
onSubmit={e => { | ||
action('onSubmit')(Object.fromEntries(new FormData(e.target as HTMLFormElement).entries())); | ||
e.preventDefault(); | ||
}}> | ||
<TextField> | ||
<Label>Address</Label> | ||
<Input name="streetAddress" type="text" id="streetAddress" autoComplete="shipping street-address" /> | ||
</TextField> | ||
<TextField> | ||
<Label>City</Label> | ||
<Input name="city" type="text" id="city" autoComplete="shipping address-level2" /> | ||
</TextField> | ||
<TextField> | ||
<Label>State</Label> | ||
<Input name="state" type="text" id="state" autoComplete="shipping address-level1" /> | ||
</TextField> | ||
<TextField> | ||
<Label>Zip</Label> | ||
<Input name="city" type="text" id="city" autoComplete="shipping postal-code" /> | ||
</TextField> | ||
<Select name="country" id="country" autoComplete="shipping country"> | ||
<Label>Country</Label> | ||
<Button> | ||
<SelectValue /> | ||
<span aria-hidden="true">▼</span> | ||
</Button> | ||
<Popover> | ||
<ListBox> | ||
<ListBoxItem>Greece</ListBoxItem> | ||
<ListBoxItem>Italy</ListBoxItem> | ||
<ListBoxItem>Spain</ListBoxItem> | ||
<ListBoxItem>Mexico</ListBoxItem> | ||
<ListBoxItem>Canada</ListBoxItem> | ||
<ListBoxItem>United States</ListBoxItem> | ||
</ListBox> | ||
</Popover> | ||
</Select> | ||
<Button type="submit">Submit</Button> | ||
</Form> | ||
); | ||
}; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird, this one renders as autocomplete off for me...
![Screenshot 2025-02-06 at 11 17 00 am](https://private-user-images.githubusercontent.com/698229/410234091-1170927b-babc-4672-ab87-517a30db9d8a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNzMyNDQsIm5iZiI6MTczOTM3Mjk0NCwicGF0aCI6Ii82OTgyMjkvNDEwMjM0MDkxLTExNzA5MjdiLWJhYmMtNDY3Mi1hYjg3LTUxN2EzMGRiOWQ4YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQxNTA5MDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02ODJkOWYzN2EzMjYwYjM3YjFiNmY3NmU4Yzc2NGNjZDU3OWE4ZGNmYzYxZjgwODA1ODhjMmFkOWM5NTg4YWY1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.OvLl9EITasg6pjsMSwZ9-CmEFgum1-D3kUFgzSPTU7M)
https://reactspectrum.blob.core.windows.net/reactspectrum/df4ad8242241bf9959c9148d20b4be683ab320df/storybook/index.html?path=/story/react-aria-components--form-auto-fill-example&providerSwitcher-express=false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh strange. it looks like it has autocomplete=""shipping address-level2" based on the screenshot. does it not autofill for you either?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, node above that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh my b. that's really weird because it appears for me. it should be valid since i see an example of it in the mdn docs...it might be good to see if another person can reproduce
do you see this in other browsers as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh, well, i updated chrome last night. now it's rendering. My Chrome autofill works on it, but my Dashlane doesn't recognize it for some reason still. At this point though, I think it's correct and I'm just running into local issues