Can the datepicker calendar not be shown on a right-click?

Can the datepicker calendar not be shown on a right-click?

divad.thgirbladivad.thgirbla Posts: 36Questions: 14Answers: 1

We're creating a custom context menu on right-clicks on our Editor screen fields. This is working correctly for all screen elements except for date fields. It seems that the datepicker's calendar popup is invoked on focus so it always fires no matter which mouse button is clicked. We'd like to suppress it on mouse right-clicks. Is there a (simple) way around this? This was tested on Chrome.

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,991Questions: 87Answers: 421
    edited October 2020 Answer ✓

    It seems that the datepicker's calendar popup is invoked on focus

    Not here ... in my Editors it is invoked on click - any click in the field.

    I used this code to turn it off on right click for date time fields:

    editor
        .on('open', function(e, mode, action) {
            $('.DTE_Field_Type_datetime').mousedown(function(e) {
                if (e.which === 3) { //right button
                    e.preventDefault();
                }
            });
        });
    
  • divad.thgirbladivad.thgirbla Posts: 36Questions: 14Answers: 1

    This was a great help. Thanks for your prompt reply.

This discussion has been closed.