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

Ensure that sidebar field will not steal focus when metadata is edited #5983

Merged
merged 20 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
62dc807
Ensure that sidebar field will not steal focus when metadata is edited
dobri1408 Apr 25, 2024
c1ab387
Update Form.jsx
dobri1408 Apr 25, 2024
6e00ba2
Update Form.jsx
dobri1408 Apr 25, 2024
49d7308
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 Apr 25, 2024
9c63253
Create 5983.bugfix
dobri1408 Apr 25, 2024
4518dd9
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 Apr 25, 2024
7d26627
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 8, 2024
6f4ce67
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 9, 2024
0a23a85
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 21, 2024
a2111cc
Create sidebar-focus.cy
dobri1408 May 22, 2024
d10e2aa
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 22, 2024
c75b2fe
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 24, 2024
0916aa0
Move test here metadata.js
dobri1408 May 27, 2024
4c79849
Delete packages/volto/cypress/tests/core/basic/sidebar-focus.cy
dobri1408 May 27, 2024
cf1f328
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 27, 2024
996b6b9
Update metadata.js
dobri1408 May 27, 2024
8dfd4b7
Fix tests from metadata.js
dobri1408 May 27, 2024
bb1ac19
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 May 27, 2024
f66f6f4
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 Jun 12, 2024
dfadc5e
Merge branch 'main' into fix-field-sidebar-stealing-focus
dobri1408 Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/volto/cypress/tests/core/basic/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,15 @@ describe('Add Content Tests', () => {
.contains('Required input is missing');
cy.get('.sidebar-container .tabs-wrapper .active.item').contains('Page');
});

it('After removing value of widget the focus should be removed from the field', () => {
cy.get('#field-creators').type('aaa');
cy.get('#field-creators')
.type('aaa{Enter}')
.get('.react-select__multi-value__remove')
.click();
cy.getSlateEditorAndType(
'Test if all the text will be in this slate block',
).contains('Test if all the text will be in this slate block');
});
});
1 change: 1 addition & 0 deletions packages/volto/news/5983.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure that sidebar field will not steal focus when metadata is edited @dobri1408
9 changes: 8 additions & 1 deletion packages/volto/src/components/manage/Form/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,14 @@ class Form extends Component {
id={field}
fieldSet={fieldset.title.toLowerCase()}
formData={formData}
focus={this.state.inFocus[field]}
focus={
this.state.isClient &&
document
.getElementById('sidebar-metadata')
?.contains(document.activeElement)
? this.state.inFocus[field]
: false
}
value={formData?.[field]}
required={
schema.required.indexOf(field) !== -1
Expand Down
Loading