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

[EuiInlineEdit] Create Component Directory and Base Functionality #6598

Merged
merged 34 commits into from
Mar 28, 2023

Conversation

breehall
Copy link
Contributor

@breehall breehall commented Feb 13, 2023

Relates to #3928

Summary

(Associated with #3928 and #6533)

Spec Doc: EuiInlineEdit Spec Doc

This is the first PR for the new EuiInlineEdit component. This PR creates the required directories for the component and the component docs. EuiInlineEdit consists of three different components: EuiInlineEditText, EuiInlineEditTitle, and EuiInlineEditButtons.

EuiInlineEditText and EuiInlineEditTitle have the same base functionality which includes:

  • Toggling between readMode and editMode
    • readMode should display an EuiEmptyButton with the saved or default text and selections
    • editMode should display an EuiFieldText input and two buttons that allow users to edit their text and save or cancel
  • Saving text and selections using a save button when the component is in editMode
    • Basic validation that does not allow the form controls to be saved when they contain no text / selections. If they are empty and a save is attempted, the component returns to readMode with the text / selections prior to editing
  • Canceling and not saving text and selections using a cancel button when the component is in editMode
  • EuiInlinEditText and EuiInlineEditTitle differ in their display. They each show the text in readMode as a text element or a title respectively.

*Note: Full documentation page and props testing coming after the base functionality is QA'd and approved.

Inline.Edit.mov

What's Next?

There were a few things noted in this PR and within the Figma spec that haven't made it into this PR just yet.

  • Styling editMode text to match the size of its readMode counterpart.
  • Creation of the placeholder prop to add a placeholder to the text input in editMode.
  • Official EuiInlineEdit examples and thorough test cases for all three components.

QA

  • Edit text for EuiInlineEdit where display == text, save changes

  • Edit text for EuiInlineEdit where display == title, save changes

  • Edit text for EuiInlineEdit, cancel changes
    The cancelled test should not persist in the button or in the input

  • Confirm sizing for EuiInlineEdit where display == text (layout should not shift)

  • Confirm sizing for EuiInlineEdit where display == title (layout should not shift)

General checklist

  • Checked in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs (using @default if default values are missing) and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

…cancel buttons. Updated the props to require an input aria label because the option to show the label on the input was removed. This was removed to preserve the layout and prevent the input from appearing to bounch when switching between editView and readView.
…d in, the button will be empty (with the exception of the edit icon)
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

@breehall breehall marked this pull request as ready for review February 15, 2023 21:09
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

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

@breehall I had so much fun testing this with VoiceOver! The component works so well. I had a couple of accessible label suggestions and one "what do you think about" for heading levels, but that's it.

LMK if you'd like a second screen reader test through next week.

src/components/inline_edit/inline_edit.tsx Outdated Show resolved Hide resolved
src-docs/src/views/inline_edit/inline_edit.tsx Outdated Show resolved Hide resolved
>
{display === 'title' ? (
<EuiTitle size={size as EuiTitleSize}>
<h2>{readViewValue}</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm almost not sure I want to put this in here, but I'll ask and feel free to call this out of scope or an enhancement item. We use a custom heading level variable on our EuiCallout#L103 component that gives some more flexibility for setting heading levels.

You can't go wrong with an H2 and if you decide to add flexibility in setting a heading level, H2 should be the default. If you opt to keep it hard coded, it's perfect as is.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

breehall added 2 commits March 2, 2023 15:23
- Updated the onConfirm prop to return a boolean flag that will determine if the text value is saved or not in editMode
- Updated edit/read prop variable names
- Exported EuiButtonEmptyPropsForButton because it's being used as a type for the new readMode prop
- Added base testing files for EuiInlineEditTitle and EuiInlineEditButtons
@breehall
Copy link
Contributor Author

breehall commented Mar 2, 2023

@cee-chen @miukimiu

✨ What's Changed?

  1. EuiInlineEdit is now comprised of three components (EuiInlineEditText, EuiInlineEditTitle, EuiInlineEditButtons). EuiInlineEditButtons is an internal component shared between Title and Text.
  2. Create a new util called getInlineEditButtonSettings that controls the compression and iconSize for all three components
  3. [EuiInlineEditTitle] Made the heading prop required so consumers are forced to select the level of heading they would like to use
  4. [EuiEmptyButton] Exported EuiButtonEmptyPropsForButton to use in EuiInlineEditCommonProps (because using EuiButtonEmptyProps didn’t make TS happy)
  5. Updated onConfirm to force a return flag. When this flag is true, the text value will be saved and the component will continue back to readMode. When the flag is false, the changes will not be saved and the component will remain in editMode. (Example below 👇🏾 )
  6. New (and basic) test for EuiInlineEditTitle and EuiInlineEditButtons
Inline.Edit.-.Confirm.mov

✨ What's Up Next?

There were a few things noted in this PR and within the Figma spec that haven't made it into this PR just yet.

  • Styling editMode text to match the size of its readMode counterpart.
  • Creation of the placeholder prop to add a placeholder to the text input in editMode. (The inline edit form control never has the opportunity to be empty. When the form is saved the content is empty, the readMode text restores. )
  • Official EuiInlineEdit examples and thorough test cases for all three components.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

Comment on lines +94 to +96
export type EuiButtonEmptyPropsForButton = PropsForButton<
CommonEuiButtonEmptyProps
>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exported this type because EuiButtonEmptyProps was causing TS errors when attempting to set up readModeProps.

@breehall breehall requested a review from cee-chen March 2, 2023 20:57
Comment on lines 60 to 82
const [isEditing, setIsEditing] = useState(startWithEditOpen);
const inlineEditInputId = useGeneratedHtmlId({ prefix: '__inlineEditInput' });

const [editModeValue, setEditModeValue] = useState(defaultValue);
const [readModeValue, setReadModeValue] = useState(defaultValue);

const cancelTitleEdit = () => {
setEditModeValue(readModeValue);
setIsEditing(!isEditing);
};

const saveTitleEditValue = () => {
if (editModeValue && onConfirm && !onConfirm()) {
// If there is text, an onConfirm method is present, and it has returned false, cancel the action
return;
} else if (editModeValue) {
setReadModeValue(editModeValue);
setIsEditing(!isEditing);
} else {
// If there's no text, cancel the action, reset the input text, and return to readMode
cancelTitleEdit();
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

A lot of this logic is repeated between the text and title components when I don't think it needs to be - a lot of it (including titleEditModeElement) should live within the shared component instead. Just spitballing, but I think if we used render prop architecture we could DRY this out to something like:

// pass all props directly to the shared component
<EuiInlineEditForm {...props}>
  {(readModeValue) => (
    <EuiTitle size={props.size}>
      <H>{readModeValue}</H>
    </EuiTitle>
  )}
</EuiInlineEditForm>

And similar for text edit:

<EuiInlineEditForm {...props}>
  {(readModeValue) => (
    <EuiText size={props.size}>{readModeValue}</EuiText>
  )}
</EuiInlineEditForm>

Let me know if that makes sense / if you get the gist from that, or if you want to pair on this tomorrow at all!

Copy link
Contributor

Choose a reason for hiding this comment

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

DRYing out more logic between EuiInlineEditText and EuiInlineEditTitle is my major change request for this feedback round, so I'll leave it here to let the dust settle before adding smaller comments. Also, I'm a huge fan of how much cleaner types & props are with this new component architecture - it's a major developer experience improvement just IMO!

…itText into a new component called EuiInlineEditForm. This new form component is responsible for the toggling of readMode and editMode for EuiInlineEdit.
Comment on lines +36 to +39
// Styles to come later! (Styling editMode text to match the size of its readMode counterpart)
/*const theme = useEuiTheme();
const styles = euiInlineEditStyles(theme);
const cssStyles = [styles.euiInlineEdit];*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Styles to come for editMode text to match the size of readMode text

@breehall
Copy link
Contributor Author

✨ Changes from the last review

  • Created a new EuiInlineEditForm component to DRY out the duplicated logic between EuiInlineEditText and EuiInlineEditTitle. This new component is now responsible for the toggle between readMode and editMode.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

@breehall breehall requested a review from cee-chen March 23, 2023 17:53
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

🎉 🚢

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

@breehall breehall merged commit b88b07c into elastic:feature/EuiInlineEdit Mar 28, 2023
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6598/

cee-chen added a commit that referenced this pull request May 25, 2023
…onents (#6757)

* [EuiInlineEdit] Create Component Directory and Base Functionality (#6598)

* Initial directory setup for EuiInlineEdit

* Initial structure for EuiInlineEdit docs

* Created EuiInlineEdit base component that toggles between a text input and text or title.

* Replaced button icons with full EuiButtons with text. Positioned the buttons on the right side of the input

* Added early snapshot for component

* Added aria-labels with i18n for the editView input, save button, and cancel buttons. Updated the props to require an input aria label because the option to show the label on the input was removed. This was removed to preserve the layout and prevent the input from appearing to bounch when switching between editView and readView.

* Combined with last commit - forgot to hit save

* Made defaultValue a required field because if there is no value passed in, the button will be empty (with the exception of the edit icon)

* Updated basic snapshot tests, updated docs

* Added button groups to documentation to make toggling button sizes easier

* Update src/components/text/index.ts

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src-docs/src/views/inline_edit/inline_edit.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src-docs/src/views/inline_edit/inline_edit.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit.test.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit.tsx

Co-authored-by: Elizabet Oliveira <elizabet.oliveira@elastic.co>

* Separated the two EuiInlineEdit examples into their own files

* Created additional logic to resize buttons and fieldtext elements when when the size of EuiInlineEdit is small or lower.

* Created a heading prop to allow consumers to choose the level heading they would like the InlineEdit (title) to be wrapped inside of. If one isn't provided, h2 will be the default.

* Updated basic test snapshots for EuiInlineEdit

* Updated new i18n tokens to be more explicit about their purpose

* Split EuiInlineEdit into three components: EuiInlineEditText, EuiInlineEditTitle, and EuiInlineEditButtons.
- Created utils and types file to share common props and utility functions between all three components

* Oops

* EuiInlineEdit Updates
- Updated the onConfirm prop to return a boolean flag that will determine if the text value is saved or not in editMode
- Updated edit/read prop variable names
- Exported EuiButtonEmptyPropsForButton because it's being used as a type for the new readMode prop
- Added base testing files for EuiInlineEditTitle and EuiInlineEditButtons

* Remove testing props from inline edit example

* Separated repeated logic inside of EuiInlineEditTitle and EuiInlineEditText into a new component called EuiInlineEditForm. This new form component is responsible for the toggling of readMode and editMode for EuiInlineEdit.

* Move types to shared internal form component

* Pass top-level props instead of in a `props` obj

* Remove top level read state, use render prop instead

- so that EuiInlineEditForm is completely in charge of state

* Remove EuiInlineEditButtons, roll into EuiInlineEditForm as inline

* Removed utility in favor of component-specific size logic

- while still DRYing out the underlying form sizes being used

* Fix types and update snapshots

* Clean up type def

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
Co-authored-by: Elizabet Oliveira <elizabet.oliveira@elastic.co>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>

* [EuiInlineEdit] Add Dynamic Font Sizing & Truncation Styling (#6660)

* Created styling for EuiInlineEdit text and title components that adjusts the font-size used within the editMode form control. Added styling to ensure that very long text is truncated inside of the EuiEmptyButton used in readMode

* Updated snapshot tests for EuiInlineEdit

* Update src/components/inline_edit/inline_edit_title.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit_text.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Updated snapshots for EuiInlineEdit test cases after modification in Github UI

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [EuiInlineEdit] Creation of the `isLoading` and `isInvalid` Props (#6667)

* Added isInvalid and isLoading props to EuiInlineEdit components (form, title, text).

* [REVERT ME] Added prop toggles to the EuiInlineEditText example for validation

* Revert "[REVERT ME] Added prop toggles to the EuiInlineEditText example for validation"

This reverts commit b72c9ca.

Reverting documentation change that was for PR assistance. It's no longer needed.

* Updated EuiInlineEditForm by removing the isLoading prop on the confirm and cancel buttons. Instead, these are wrapped in the skeleton component when loading.

* Added a new documentation view for the isLoading prop

* Updated the editModeProps property to include the erorr prop from EuiFormRowProps. Additionally wrapped EuiFieldText inside of EuiFormRow. This is to allow consumers to pass an error message to the EuiFormRow when the isValid prop is false.

* -[PR Feedback] Removed the onChange method from the loading example and placed it directly on the switch element
- Created the isValid documentation example

* Remove blunder

* Added the skeletonHeight index to sizes object. The Skeleton buttons used when isLoading is true need to be smaller when the form is compressed

* [PR Feedback - Update the editModeProps prop to include two sub-objects. This includes one that will be placed on the form row and the other will be placed on the input form control in edit mode

* [PR Feedback - Combined the isLoading and isValid prop documentation examples. Removed the isValid example completely.

* [PR Feedback - Remove hard coded values used for the EuiSkeletonRectangle height when isLoading is true

* Update src/components/inline_edit/inline_edit_form.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit_form.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit_form.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Updated docs that used the editModeProps prop with EuiInlineEdit

* Removed unused code block in EuiInlineEditForm

* Update src-docs/src/views/inline_edit/inline_edit_example.js

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [PR Feedback] - Removed readModeProps from InlineEditTitle example. Allowed Prettier to format the copy on a documentation file

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [EuiInlineEdit] Create `EuiInlineEdit` Docs (#6697)

* Export the EuiInlineEdit Text and Title prop types

* Created docs examples for EuiInlineEdit props

* Removed an export for EuiInlineEditTextSizes as devs can drill into Title and Text props for the size

* [PR Feedback] - Reorder sections of the EuiInlineEdit docs. Update the copy included in a few examples for better understanding

* [Oops] Removed and replaced the EuiInlineEditTextSize import in InlineEdit Text example

* Update src-docs/src/views/inline_edit/inline_edit_example.js

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [EuiInlineEdit] Test Cases for `EuiInlineEdit` (#6722)

* Added Cypress tests for EuiInlineEdit functionality

* Added snapshots for read mode and edit mode for the Text and Title variations for EuiInlineEdit

* Use RTL render method for snapshots

* [InlineEditForm] - Add data-test-subj to EuiInlineEditForm buttons and inputs
- Removed opinionated save logic that prevented users from being able to save empty strings in editMode

* Created test cases for EuiInlineEditForm. These test cases handle the functional and prop testing for both the Text and Title variations of the component

* Updated InlineEdit Text and Title test suites to only include basic render tests and snapshots of their sizing in both readMode and editMode

* Removed Cypress test in favor of testing EuiInlineEdit with Jest

* Created the onSave prop that returns that latest value within EuiFieldText (in editMode) at the time the save button is clicked.

* [REVERT ME] Added text to the InlineEditText example to display the use of the onSave prop

* Updated onSave prop test to use the Jest mock function call instead of relying on variable value changes

* [PR Feedback] Remove tests that toggled between read/edit mode in EuiInlineEdit Text and Title test suites.

* [PR Feedback] - Updated the descriptions for the onSave and onConfirm props
- Removed data-test-subj IDs from the loading skeleton rectangles
- Updated the isLoading prop to default to false and removed explicit declarations in Text and Title

* [PR Feedback] Updated EuiInlineEditForm test cases with more specific cases for onSave. Removed the isLoading default set in the props for the form as it's no longer needed

* Revert "[REVERT ME] Added text to the InlineEditText example to display the use of the onSave prop"

This reverts commit 6005e53.

Removing modifications to docs file as they were only needed for testing

* Created a new documentation example to showcase the onSave prop

* Update src-docs/src/views/inline_edit/inline_edit_example.js

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [EuiInlineEdit] Refactor multiple props to harden for real-world production usage + misc cleanup (#6735)

* Save example misc cleanup

- remove button that clears localStorage - it's not necessary for the demo and we can do so in devtools instead

- remove onConfirm doc copy - going to move that to a new section

* Add support for async saving + validation

- remove confusing extra `onConfirm` callback for handling everything in a single `onSave`

- remove extra `onSave` prop test - just roll that behavior into the last describe block

* Update documentation examples

- update confirm example to more closely mimic production behavior

- remove dedicated isLoading/isInvalid demo - we can demo that in the production example instead

* Remove specific `ariaLabel` props in favor of generic props that can be spread to the save & cancel buttons

- this is necessary for consumers to do things like reset errors on cancel, or fire telemetry events on click

+ remove `disabled` state of save button on `isInvalid` - but consumers can add that back in if needed via `saveButtonProps`, depending on their specific UX

+ minor type cleanup

* Support custom `onClick` events for all button props

- clicks should call both internal EUI handlers and consumer callbacks

* Misc cleanup

- Remove unnecessary toggle on isEditing switches which could potentially create race conditions - we know it should always be either true or false depending on the mode being entered/exited

- Improve prop docs readability

- make `it` vs. `test` syntax/grammar more consistent

- Remove unnecessary false fallbacks - undefined is already falsy

* Improve docs a bit more

- react typegen is mutilating `editModeProps`, so we should more explicit in our manual prop docs

- update the last docs example

* PR feedback: typo

Co-authored-by: Bree Hall <40739624+breehall@users.noreply.github.com>

---------

Co-authored-by: Bree Hall <40739624+breehall@users.noreply.github.com>

* [EuiInlineEdit] Add `onKeyDown` Mapping for Saving and Canceling Edits (#6742)

* [EuiInlineEdit] Add keydown events that map the Enter and Escape keys to the save and cancel functions respectively.

* [REVERT ME] Added a custom keydown event that overrides our Enter mapping as an example

* [PR Feedback] Various structural updates including renaming test cases and updating logic to run both the default and custom onKeyDown methods for the edit mode input.

* [PR Feedback] Remove autoFocus from both the read mode button and edit mode input in favor of manual focus management. Created a ref/useEffect combo that keeps track of the state and sets focus on the edit mode input only when the read mode button is clicked.

* Add aria-describedby property to the edit mode input

* Revert commit c48ee4f.

* Revert 2460856

* Pull aria-describedby outside of the edit mode input form row

* Update test case to validate that custom onKeyDown events work along side the default events

* [EuiInlineEdit] Add Playground & Code Snippets (#6743)

* [EuiInlineEdit] Create a playground for both EuiInlineEdit Text and Title

* [EuiInlineEdit] Add code snippets for each InlineEdit example in the docs

* Removed the inline edit validation code snippet in favor of the DemoJS because it's more helpful

* Small updates to DRY util.

* Added the span option to the list of headings available for EuiInlineEdit Title.

* Update EuiInlineEdit Title heading prop documentation for clarity

* Update src/components/inline_edit/inline_edit_title.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [EuiInlineEdit] DOM cleanup, a11y improvements, and fix breaking `onChange` bug (#6746)

* DOM cleanup

- Remove unnecessary `EuiForm` - we're not taking advantage of form submit behavior, so we might as well remove this

- Remove unnecessary `EuiFormRow`s around save/cancel buttons - they're not inputs and don't need form rows

- Remove incorrect `className={classes}` placement

* Use `EuiSkeletonLoading` instead of 2 `EuiSkeletonRectangle`s

- this prevents double loading screen reader announcements

* Update EuiInlineEdit to only announce when state flips to loading

- so that a "loaded" announcement doesn't occur whenever edit mode is opened, which doesn't make a whole lot of sense

* Improve SR UX of read mode

- add an `aria-describedby` that explains to screen reader users what happens when the read mode button is clicked, since the text itself is not indicative

+ cleanup: remove unused input ID

* Fix `editModeProps.inputProps.onChange` overriding/breaking behavior

* Remove `autoFocus` in favor of imperative `.focus()` calls on click

- rAF is needed to wait a tick after state has changed and DOM node is available

+ write tests (with waitFor) asserting that focus state works as expected (mocking rAF primarily for test/function coverage)

* [PR feedback] `toggle`->`activate`

* Removed unneeded style file and references to it. (#6751)

* Update src-docs/src/views/inline_edit/inline_edit_example.js

Co-authored-by: Trevor Pierce <1Copenut@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit_form.tsx

Co-authored-by: Trevor Pierce <1Copenut@users.noreply.github.com>

* Update src-docs/src/views/inline_edit/inline_edit_example.js

Co-authored-by: Trevor Pierce <1Copenut@users.noreply.github.com>

* [EuiInlineEdit] `CHANGELOG` & Copy Linting (#6788)

* Changelog & text linting from changes made in Github UI

* Snapshot update as a result of updating the copy of the aria-describedby used by inline edit

* [EuiInlineEdit] Create `isReadOnly` Prop for Read Mode (#6777)

* [EuiInlineEdit] Add the isReadOnly prop that locks the component in read mode and does not allow the user to update text

* [EuiInlineEdit] Update snapshots to account for new inline_edit_form styles. Added a test case for the new isReadOnly prop

* [EuiInlineEdit] Forgot to add snapshot updates

* [REVERT] Add documentation example to InlineEdit Text to display isReadOnly prop

* Revert "[REVERT] Add documentation example to InlineEdit Text to display isReadOnly prop"

This reverts commit 8a7b117.

Revert change made to demo for testing

* [PR Review]
- Add an official example for the isReadOnly prop
- Name correction in edit mode props example

* [PR Feedback]
- Updated the name of Emotion style object to indicate we're styling the read mode button, not the entire form
- Conditionally hide the text content of aria-describedby when isReadOnly is true
- Conditionally add a role (and aria-level where required) to the read mode button when isReadOnly is true

* Update and add test cases

* [PR Feedback] - Update conditional aria-describedby span to surround the text instead of the entire span.
- Clean up logic related to adding aria-live and role attributes when isReadOnly is true

* Update src-docs/src/views/inline_edit/inline_edit_read_only.tsx

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Update src/components/inline_edit/inline_edit_form.styles.ts

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [PR Feedback] -Add note in inline_edit_form.style.ts that we should reevaluate styles once EuiEmptyButton is converted to Eotion.
- Updated render condition for edit mode to ensure if isReadOnly is true, we stay / kick back to read mode
- Test case & snapshot updates

* [PR Feedback] Move the isReadOnly prop example up in the documentation

* Snapshots

* Update src-docs/src/views/inline_edit/inline_edit_example.js

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* [PR Feedback] - Removed conditiona lo logic to force a toggle from read mode to edit mode when isReadOnly is true. Opted for a useEffect that will handle the change instead

* Oops!

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>

* Snapshots

* [EuiInlineEdit] Final screen reader / a11y polish pass (#6805)

* Fix conditional readonly aria-describedby

- it was wrapped around the wrong SR text

* Prevent double heading roles when readonly

- leave role as undefined/unset otherwise, as `span` elements should not have a `heading` role

* (hopefully) Fix enter screen reader behavior

* Fix VO announcing EuiInlineEditText as `clickable` in read only mode

* Revert "Fix VO announcing EuiInlineEditText as `clickable` in read only mode"

This reverts commit 0f483bd.

* NVDA browser mode fix

* Revert Escape preventDefault

- not actually doing anything :wompwomp:

* [misc UX enhancement]

Set `readOnly` on input / prevent further user editing when saving & is in `isLoading` state

- docs only improvement as I don't want to tie the two props together (slightly opinionated), but hopefully consumers copy it

* [mobile] Fix edit mode buttons wrapping to next line in small screens

* [misc docs tweaks]

- add `size` props to text/title snippets

- move longer mode props snippet further down to match location on page

- reorder props in demos by relative importance/requirement (or remove if not important)

* Add demo section for `startWithEditOpen` prop

* [misc cleanup/nits]

- rename exported form styles more accurately to their usage

- test name casing, + don't use camelCasing for non props

---------

Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
Co-authored-by: Elizabet Oliveira <elizabet.oliveira@elastic.co>
Co-authored-by: Constance Chen <constance.chen.3@gmail.com>
Co-authored-by: Trevor Pierce <1Copenut@users.noreply.github.com>
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.

5 participants