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

feat!: Implement HasPlaceholder #18081

Merged
merged 7 commits into from
Nov 22, 2023
Merged

feat!: Implement HasPlaceholder #18081

merged 7 commits into from
Nov 22, 2023

Conversation

mvysny
Copy link
Member

@mvysny mvysny commented Nov 21, 2023

Description

Implement the HasPlaceholder interface.

Fixes #4068

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@mvysny mvysny marked this pull request as draft November 21, 2023 04:19
Copy link

github-actions bot commented Nov 21, 2023

Test Results

1 042 files  1 042 suites   1h 13m 43s ⏱️
6 700 tests 6 655 ✔️ 45 💤 0
7 004 runs  6 948 ✔️ 56 💤 0

Results for commit 0337d70.

♻️ This comment has been updated with latest results.

@mvysny mvysny marked this pull request as ready for review November 21, 2023 06:33
@vaadin-bot vaadin-bot added +1.0.0 and removed +0.1.0 labels Nov 21, 2023
@mvysny
Copy link
Member Author

mvysny commented Nov 21, 2023

Warning: this PR brings in an incompatible change since it changes the result type of Input.getPlaceholder() from Optional<String> to String. I'd argue that this is OK since:

  1. It unifies the return type for Input and for all other components, e.g. TextField
  2. placeholder is now again a bean property
  3. Returning null will not overwhelmingly cause errors since getPlaceholder() is used sparingly, if at all.

@mvysny mvysny requested review from mshabarov and Artur- November 21, 2023 06:45
@mcollovati mcollovati changed the title feature: Implement HasPlaceholder. Fixes #4068 feat!: Implement HasPlaceholder Nov 21, 2023
@mvysny mvysny requested a review from mcollovati November 21, 2023 07:25
Copy link
Collaborator

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but I have a couple of questions:

  • do we still need to use the property descriptor in the Input element?
  • shouldn't also RangeInput implement the new interface?
  • should we also update the InputTextElement in flow-html-components-testbench to make it implement com.vaadin.testbench.HasPlaceholder

@mcollovati
Copy link
Collaborator

BTW, we should probably create an issue for implementing the testbench RangeInputElement

@mcollovati mcollovati added the Contribution PRs coming from the community or external to the team label Nov 21, 2023
@mvysny
Copy link
Member Author

mvysny commented Nov 22, 2023

do we still need to use the property descriptor in the Input element?

Unfortunately yes, because Input element sets the placeholder attribute, while all other web components and all Has* interfaces set the property. Therefore, we need to override the default implementation in Input.

shouldn't also RangeInput implement the new interface?

Nope, <input type="range"> doesn't support the placeholder attribute as per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range

should we also update the InputTextElement in flow-html-components-testbench to make it implement com.vaadin.testbench.HasPlaceholder

Yup, but I can't figure out how to run IT tests in flow-html-components-testbench unfortunately.

BTW, we should probably create an issue for implementing the testbench RangeInputElement

Agree: #18093

mcollovati
mcollovati previously approved these changes Nov 22, 2023
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mvysny mvysny merged commit 62e20bf into main Nov 22, 2023
25 of 26 checks passed
@mvysny mvysny deleted the feature/4068 branch November 22, 2023 06:55
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.3.0.alpha6 and is also targeting the upcoming stable 24.3.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create HasPlaceholder interface
3 participants