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
FORMS-13811 | Adding rendition for hCaptcha #1174
Conversation
863f7fb
to
39f0ce7
Compare
...ps/src/main/content/jcr_root/apps/core/fd/components/form/hcaptcha/v1/hcaptcha/hcaptcha.html
Show resolved
Hide resolved
* Defines the form {@code Captcha} Sling Model used for the {@code /apps/core/fd/components/form/hcaptcha/v1/hcaptcha} | ||
* component. | ||
* | ||
* @since com.adobe.cq.forms.core.components.models.form 2.0.0 |
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.
Please bump the minor version, since you have created a new interface. also update the docs
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.
Please add test case for this code. Also, create a sample in core component on how one could create a custom captcha. You can check the existing code where we have test cases for custom components.
ce3c8da
to
ed90550
Compare
...e/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImpl.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImpl.java
Show resolved
Hide resolved
...e/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImpl.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/HCaptchaImpl.java
Show resolved
Hide resolved
...cr_root/apps/core/fd/components/form/hcaptcha/v1/hcaptcha/clientlibs/site/js/hcaptchaview.js
Outdated
Show resolved
Hide resolved
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.
check comments
* @since com.adobe.cq.forms.core.components.models.form 5.4.0 | ||
*/ | ||
@ConsumerType | ||
public interface HCaptcha extends Captcha {} |
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.
we should not need this interface if its not adding any new method over the base interface.
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.
This is just a marker interface to be consumed by HCaptchaImpl.
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.
Why can't the impl just implement Captcha?
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.
This is consumed by sightly, if we use HCaptchaImpl implemented Captcha then it would have not picked up the correct impl.
(function() { | ||
|
||
"use strict"; | ||
class HCaptcha extends FormView.FormFieldBase { |
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.
since we are already inheriting from recaptcha RT, is there any reason to have dedicated clientlibs for hcaptcha? we could have even reused the bem block for all captcha providers (thinking about our guidance to customers in future to implement another captcha provider as a separate component).
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.
I had a discussion long back with @sakshi-arora1, and it was a conscious decision to keep separate captcha components in AFv2. @sakshi-arora1 can comment more about the same.
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.
The components should be different (in terms of inserting them). I'm just wondering whether we need to duplicate the code in each captcha component and what would be our recommendation for a custom captcha comp in future for customers?
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.
So maybe we can have a captcha utils in place which can be reused by multiple captcha components ?
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/--> | ||
<sly data-sly-use.renderer="${'hcaptcha.js'}" |
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.
again, since we are already inheriting recaptcha, any reason to redefine this sightly again? is it just for bem selectors?
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.
Yep, just for the bem selectors.
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.
Is there a styling use case for captcha?
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.
For the error message, which appears if user tries to submit without filling the captcha
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.
Ok. Personally I'd have preferred to keep bem selector same for both recaptcha and hcaptcha or any other captcha provider that may be integrated in future. And that would also have enabled anyone implementing a custom captcha component by just inherting an existing captcha component (for client libs and sightly). Wdyt?
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.
In this approach, we should release a v2 version of Recaptcha core component with a generic bem model. As the current bem model is specific to recaptcha (https://github.com/adobe/aem-core-forms-components/blob/master/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/recaptcha/v1/recaptcha/clientlibs/site/css/recaptchaview.css#L9)
And for custom captcha, apart from client libs and sightly; cq:dialog might also need to be overridden for the custom captcha.
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.
Ok. Personally I'd have preferred to keep bem selector same for both recaptcha and hcaptcha or any other captcha provider that may be integrated in future. And that would also have enabled anyone implementing a custom captcha component by just inherting an existing captcha component (for client libs and sightly). Wdyt?
From a technical perspective, maintaining unique BEM selectors for different captcha providers such as reCAPTCHA and hCaptcha helps ensure that the styling and behaviors of these components are distinctly manageable. This can be particularly useful in cases where the captchas might have differing visual or functional requirements that could conflict if merged under a single BEM namespace.
Furthermore, using distinct BEM selectors can avoid potential clashes in CSS and JavaScript (some customers don't use recommended best practices, and use BEM selectors in JS
), which might occur if the same class names are applied across different libraries or functionalities. This separation ensures that updates or changes to one captcha implementation do not inadvertently affect the styling or functionality of another.
If we receive feedback indicating a need for a more unified approach, we should reconsider our strategy. For now, maintaining separate selectors provides us with greater control and minimizes risk of cross-component interference.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1174 +/- ##
============================================
+ Coverage 80.87% 80.89% +0.01%
- Complexity 786 791 +5
============================================
Files 91 92 +1
Lines 2123 2146 +23
Branches 289 292 +3
============================================
+ Hits 1717 1736 +19
- Misses 252 253 +1
- Partials 154 157 +3 ☔ View full report in Codecov by Sentry. |
Accessibility Violations Found
|
1 similar comment
Accessibility Violations Found
|
Lighthouse scores (desktop)
|
Lighthouse scores (mobile)
|
Accessibility Violations Found
|
2 similar comments
Accessibility Violations Found
|
Accessibility Violations Found
|
Lighthouse scores (mobile)
|
Lighthouse scores (desktop)
|
Accessibility Violations Found
|
1 similar comment
Accessibility Violations Found
|
bee8b2a
to
2700fbf
Compare
Lighthouse scores (mobile)
|
Lighthouse scores (desktop)
|
Accessibility Violations Found
|
2 similar comments
Accessibility Violations Found
|
Accessibility Violations Found
|
2700fbf
to
b1dbce5
Compare
Accessibility Violations Found
|
Lighthouse scores (desktop)
|
Lighthouse scores (mobile)
|
Accessibility Violations Found
|
1 similar comment
Accessibility Violations Found
|
* embedding forms-sdk api * adding hcaptcha and recaptcha models * :fix hcaptcha model SlingException * :fix deleting recaptcha model * FORMS-13811 | Adding rendition for hCaptcha * FORMS-13811 | Renamed public API * FORMS-13811 | Embedding hcaptcha js * FORMS-13811 | Adding unit test for sling model * FORMS-13811 | Adding cypress test * FORMS-13811 | Adressing review comments * Adding e2e test * FORMS-13811 | fix import statements * Update pom.xml * Adding FT for running Tests * FORMS-13811 | Removing java-8 build for master * Adding FT in test * FORMS-13811 | Tests should run only with latest addon * FORMS-13811 | Tests should run only with latest addon * increasing coverage * addressing review comments --------- Co-authored-by: Navneet Agarwal <navneeta@adobe.com>
* embedding forms-sdk api * adding hcaptcha and recaptcha models * :fix hcaptcha model SlingException * :fix deleting recaptcha model * FORMS-13811 | Adding rendition for hCaptcha * FORMS-13811 | Renamed public API * FORMS-13811 | Embedding hcaptcha js * FORMS-13811 | Adding unit test for sling model * FORMS-13811 | Adding cypress test * FORMS-13811 | Adressing review comments * Adding e2e test * FORMS-13811 | fix import statements * Update pom.xml * Adding FT for running Tests * FORMS-13811 | Removing java-8 build for master * Adding FT in test * FORMS-13811 | Tests should run only with latest addon * FORMS-13811 | Tests should run only with latest addon * increasing coverage * addressing review comments --------- Co-authored-by: Navneet Agarwal <navneeta@adobe.com>
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: