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

Add disableOnInputFields option, which allows to automatically disable keyboard events on all input fields #557

Merged
merged 5 commits into from
Jan 18, 2022

Conversation

st-h
Copy link
Contributor

@st-h st-h commented Dec 26, 2021

resolves #212

Copy link
Collaborator

@lukemelia lukemelia left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @st-h. In order to be merged, this PR would need tests validating how this option interacts with various modifiers and scenarios.

@st-h
Copy link
Contributor Author

st-h commented Dec 26, 2021

Thanks for working on this @st-h. In order to be merged, this PR would need tests validating how this option interacts with various modifiers and scenarios.

Could you please add more details about what you expect? Like a duplicated acceptance test (ember-keyboard-test.js), with the new option enabled, so we can ensure everything still works as expected?

@lukemelia
Copy link
Collaborator

Could you please add more details about what you expect? Like a duplicated acceptance test (ember-keyboard-test.js), with the new option enabled, so we can ensure everything still works as expected?

Sounds like a good start. The place where this change is affects nearly all the functionality of the plugin so we would want the tests to give us confidence that it is doing so in an expected manner, and that future changes do not affect the intended effect of this configuration option.

@st-h
Copy link
Contributor Author

st-h commented Dec 26, 2021

cool. Just pushed some tests. Hopefully that will do. No offence, but the tests are just so much adapted to this addon, it's quite an effort to figure out what is going on.

@@ -65,6 +69,15 @@ export default class KeyboardService extends Service {

@action
_respond(event) {
if (this._disableOnInput && event.target) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@st-h @lukemelia I think it may be more flexible to be able to configure this per modifier instance, however tat may be done as a next step enhancement

@SergeAstapov
Copy link
Contributor

@st-h would you mind to add docs for this new feature so it could be explored by others?

@st-h
Copy link
Contributor Author

st-h commented Dec 27, 2021

@st-h would you mind to add docs for this new feature so it could be explored by others?

@SergeAstapov I've added a short paragraph to tests/dummy/app/templates/usage.hbs
Is there a better place or is some content missing?

@SergeAstapov
Copy link
Contributor

@st-h my bad, missed it on first pass. This looks good to me!

We can iterate on tests and restructure them in a follow up PRs. Thanks for the call out!

Copy link
Collaborator

@lukemelia lukemelia left a comment

Choose a reason for hiding this comment

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

Getting there! I left a few comments to improve the new test file.

);
});

test('test event does not propagate on input field', async function (assert) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the key test of the file. Let's move it to the top and also add one that shows a key event firing associated with a non-input element and still triggering responders.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved that test to the top. What is wrong with the other tests In order to ensure that? Am I missing something? I copied all the other tests, because they test the standard features and added a test that makes sure input fields now do not propagate. Anything special you are looking for?

@st-h
Copy link
Contributor Author

st-h commented Jan 15, 2022

sorry about taking so long. I've made the requested changes. Yet, I wonder... wouldn't it have been easier to just make the changes instead of writing them down here?

Copy link
Collaborator

@lukemelia lukemelia left a comment

Choose a reason for hiding this comment

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

Looks good!

@lukemelia lukemelia merged commit 01551b3 into adopted-ember-addons:master Jan 18, 2022
@lukemelia lukemelia mentioned this pull request Jan 18, 2022
@lukemelia
Copy link
Collaborator

Released as 7.0.1

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.

How to use v6 modifiers version to not trigger when textarea is focused?
3 participants