Skip to content

Focus on first visible field in form and in navigable layouts #1517

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

pavi41
Copy link
Contributor

@pavi41 pavi41 commented Jan 29, 2025

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

Sorry, something went wrong.

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

1 similar comment
@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.32%. Comparing base (945972f) to head (399f332).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##                dev    #1517   +/-   ##
=========================================
  Coverage     82.32%   82.32%           
  Complexity     1000     1000           
=========================================
  Files           108      108           
  Lines          2603     2603           
  Branches        370      370           
=========================================
  Hits           2143     2143           
  Misses          272      272           
  Partials        188      188           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious




const firstVisibleChild = findFirstVisibleEnabledChild(formContainer.getModel()._children)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you using private API's ? please only use public API from the model

@@ -225,6 +225,21 @@
panel.classList.add(this.constructor.cssClasses.panel.expanded);
panel.classList.remove(this.constructor.cssClasses.panel.hidden);
panel.setAttribute("aria-hidden", false);

if (document.activeElement === button) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this code required ? Its not clear, can you add some comments. Since this is part of common.js, this would also execute in authoring, which I don't think we need for this use-case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want focus on the first field when tab expands so I have integrated it in the expansion logic


// ... existing code ...

focusToFirstVisibleField(id) {
Copy link
Collaborator

@rismehta rismehta Feb 4, 2025

Choose a reason for hiding this comment

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

Indent the code and remove the commented code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed!

Copy link
Collaborator

@rismehta rismehta left a comment

Choose a reason for hiding this comment

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

check comments

@pavi41 pavi41 force-pushed the FORMS-16650 branch 4 times, most recently from b7cc690 to 3baa68b Compare February 6, 2025 10:11
@adobe-bot
Copy link

Lighthouse scores (mobile)

Performance Accessibility Best-Practices SEO
Scores 93 96 96 75

@adobe-bot
Copy link

Lighthouse scores (desktop)

Performance Accessibility Best-Practices SEO
Scores 100 96 96 75

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

2 similar comments
@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Lighthouse scores (desktop)

Performance Accessibility Best-Practices SEO
Scores 100 96 96 75

@adobe-bot
Copy link

Lighthouse scores (mobile)

Performance Accessibility Best-Practices SEO
Scores 92 96 96 75

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

2 similar comments
@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

Copy link
Contributor

@sakshi-arora1 sakshi-arora1 left a comment

Choose a reason for hiding this comment

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

Add repeatability test case, 1st tab repeat, middle tab repeat and the last tab repeat.

@adobe-bot
Copy link

Lighthouse scores (mobile)

Performance Accessibility Best-Practices SEO
Scores 93 96 96 75

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Lighthouse scores (desktop)

Performance Accessibility Best-Practices SEO
Scores 100 96 96 75

@adobe-bot
Copy link

Lighthouse scores (mobile)

Performance Accessibility Best-Practices SEO
Scores 92 96 96 75

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

1 similar comment
@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Lighthouse scores (mobile)

Performance Accessibility Best-Practices SEO
Scores 93 96 96 75

@adobe-bot
Copy link

Lighthouse scores (desktop)

Performance Accessibility Best-Practices SEO
Scores 100 96 96 75

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

1 similar comment
@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Lighthouse scores (desktop)

Performance Accessibility Best-Practices SEO
Scores 100 96 96 75

@adobe-bot
Copy link

Lighthouse scores (mobile)

Performance Accessibility Best-Practices SEO
Scores 92 96 96 75

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

2 similar comments
@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

@adobe-bot
Copy link

Accessibility Violations Found

Id Impact
label-title-only serious
target-size serious

const tab = this.getModel().getState().items.find(item => item.type === 'array')?.items?.find(subItem => subItem.id === panelId)
const field = form.getElement(tab?.id);
if (field) {
setTimeout(() => {form.setFocus(field)}, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is there setTimeout in the code ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setTimeout is used because view takes some time to get initialized and in the meantime, set focus happens so it does not create a focus and there is a warning in the console that view is not initialised.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Focus should also be async, we should make use of Focus event here ? I am merging this due to code freeze, but create a backlog JIRA to get rid of setTimeout

})
})
})
// it(" fullName field should update on change in first name and last name ", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this test case commented, if configuration for EDS is already added

@rismehta
Copy link
Collaborator

Merging since sakshi approved

@rismehta rismehta merged commit 4d73547 into dev Apr 23, 2025
11 checks passed
@rismehta rismehta deleted the FORMS-16650 branch April 23, 2025 10:46
arunattri26 added a commit that referenced this pull request Apr 24, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
* Merge pull request #1565 from adobe/ver54

update aem base image

* Updating toggle bundle (#1566)

* FORMS-17107: Client-side custom function parsing changes (#1562)

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: incorporated review comments

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: incorporated review comments

* FORMS-17107: incorporated review comments

* FORMS-19095: Enable API Call tool UI for both AEM and SPA

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

* FORMS-17107: Client-side custom function parsing changes

---------

Co-authored-by: Arun Kumar Attri <[email protected]>

* fix: Add null check for span element in radio button component (#1572)

Co-authored-by: Shivam Agarwal <[email protected]>

* Focus on first visible field in form and in navigable layouts (#1517)

Co-authored-by: Pavitra Khatri <[email protected]>

* FT_FORMS-17107: disable client-side custom function parsing toggle (#1577)

* FT_FORMS-17107: disable client-side custom function parsing toggle

* FT_FORMS-17107: update custom function collateral

* FORMS-17107: update custom function collateral

---------

Co-authored-by: Arun Kumar Attri <[email protected]>

---------

Co-authored-by: Rishi Mehta <[email protected]>
Co-authored-by: Arun Kumar Attri <[email protected]>
Co-authored-by: Shivam Agarwal <[email protected]>
Co-authored-by: Shivam Agarwal <[email protected]>
Co-authored-by: pavi41 <[email protected]>
Co-authored-by: Pavitra Khatri <[email protected]>
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.

None yet

4 participants