GDSC-SIT-2024 / HacktoberFest-Session24

2 stars 34 forks source link

Updating the index.html removing the issues #3

Open sayantann7 opened 2 hours ago

sayantann7 commented 2 hours ago
  1. Missing Closing Tag in Back Section Issue Description: There is an incomplete <div class= in the "back" section of the code.

Explanation: The incomplete div tag can cause rendering issues because the browser will not be able to interpret it correctly. This may lead to broken layout or missing elements on the page.

Fix: Close the div tag properly, and ensure that all the child elements are correctly nested.

  1. Incorrect num Type in Input Fields Issue Description: is used for the card number fields.

Explanation: HTML doesn’t have an input type of num. The correct type should be number. While most browsers might handle this gracefully, using num is technically incorrect and could cause issues with validation or rendering in certain contexts.

Fix: Change type="num" to type="number".

  1. Non-Semantic Use of div for Credit Card Information Issue Description: The credit card details (number, card holder, expiration date, CCV) are enclosed in div elements without input fields.

Explanation: For accessibility and correct form behavior, each piece of card information should be wrapped in semantic HTML elements such as input, not just div. The current structure prevents users from interacting with the fields and also breaks form submission.

Fix: Replace the div elements with proper input fields where user input is expected.

  1. Placeholder Expiration Year and Future-Proofing Issue Description: The expiration year options are hardcoded with years from 2016 to 2025.

Explanation: Hardcoding the years limits the usability of the form after 2025. This can cause usability issues in the future, as users won’t be able to select a valid expiration year beyond 2025.

Fix: Instead of hardcoding the years, dynamically generate them based on the current year.

Code After Fix (in JavaScript): javascript Copy code const currentYear = new Date().getFullYear(); const yearSelect = document.getElementById('card-expiration-year');

for (let i = currentYear; i <= currentYear + 10; i++) { const option = document.createElement('option'); option.value = i; option.textContent = i; yearSelect.appendChild(option); }

  1. Lack of Form Validation Issue Description: The form lacks client-side validation for important fields like the card number, expiration date, and CCV.

Explanation: Without validation, users could submit incomplete or incorrect data, leading to errors in processing. Client-side validation improves the user experience by providing immediate feedback.

Fix: Implement basic validation for each field, ensuring that the card number, expiration date, and CCV follow standard formats. You can use HTML5 attributes like required, pattern, and maxlength for basic validation.

  1. Missing ARIA Labels and Accessibility Features Issue Description: The form lacks accessibility features such as ARIA labels and tabindex attributes for interactive elements.

Explanation: For users with disabilities, such as those using screen readers, accessibility features ensure that the form can be navigated and understood. Without ARIA labels and proper keyboard navigation, the form may not be usable for everyone.

Fix: Add appropriate ARIA labels and ensure all interactive elements are accessible via keyboard navigation.

Soyvor commented 2 hours ago

Ok solve the issue and move forward with them