Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:14:57+00:00 2026-06-15T03:14:57+00:00

Consider the following trivial example: <input data-bind=value: query, valueUpdate: ‘afterkeydown’/> In knockoutjs 2.1.0, when

  • 0

Consider the following trivial example:

<input data-bind="value: query, valueUpdate: 'afterkeydown'"/>

In knockoutjs 2.1.0, when I press any of ctrl,Up arrow,Down arrow,Shift the binding is not fired and query is not updated.

In knockoutjs 2.2.0, the binding fires for all the above keypresses.

This is playing havoc with some existing code (it’s an autocomplete, and arrow up and down are frequently used to select from the drop down).

Which behaviour is correct? I assume technically, the latter is correct as these pressing these keys is a keydown event, but shouldn’t the binding only fire if the value has changed?

I want to keep everything real-time, and the docs state:

“afterkeydown” is the best choice if you want to keep your view model updated in real-time

Suggestions?

  • ko 2.1.0 demo: http://jsfiddle.net/Rmcza/7/
  • ko 2.2.0 demo: http://jsfiddle.net/Rmcza/8/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:14:59+00:00Added an answer on June 15, 2026 at 3:14 am

    I think this is a result of this change made by RP Niemeyer in Sept. It causes computed observables to always write when triggered, even if the value hasn’t changed.

    You will notice in this fiddle that this does not occur when using a non-computed observable. I tested this using an explicit subscription, and the event does not fire for the down arrow.

    this.test = ko.observable('');
    this.test.subscribe(function(newValue) {
        alert("The test value new name is " + newValue);
    });
    

    Maybe Ryan can explain why this was changed, and why computed’s are behaving differently than regular observables in this case. You might want to make an issue on the GitHub page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following example: #include <iostream> #include <functional> #include <algorithm> #include <vector> #include <boost/bind.hpp> const
Consider following example. #include <iostream> #include <algorithm> #include <vector> #include <boost/bind.hpp> void func(int e,
Please, consider the following trivial example: http://jsfiddle.net/mark69_fnd/vtLrt/ As you can see, it prints: A1
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Consider following example: class CBase abstract { protected: CBase() { } }; I could
Consider following example: #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <hiredis/hiredis.h> int main(int argc,
Please, consider the following trivial jade template: form block balance block address_info block additional_info
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
Consider following XML document fragment: <Book> <Title>Example</Title> <Content> Some line </Content> <TOC> Again some
consider following example: <root> <instruments> <flute> <baz>bazik</baz> </flute> <guitar> <deep> <baz>more bazik</baz> </deep> </guitar>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.