Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    _canFocus() on a LinkItem doesn't check this.canFocus

    I am tracking down a warning message which looks like this:

    Code:
    *10:47:02.694:TMR1:WARN:AttachmentItem:isc_AttachmentItem_0[htpSecXlsx]:Attempting to apply event handlers to this item. Unable to get a pointer to this item's focus element
    which is a subclass of LinkItem. I think the problem is that I lazily hacked getLinkHTML and didn’t call linkHTML with all the appropriate arguments, but I don’t really care because I don't need it to be focusable. I tried to avoid the error by setting canFocus:false, but I noticed that other FormItems which override _canFocus look like this:

    Code:
        _canFocus : function () {
            if (this.canFocus != null) return this.canFocus;
            // needs to be focusable in screen reader mode because the value will only be read if the item                  
        // can be tabbed to                                                                                             
        return isc.screenReader;
        },

    but LinkItem looks like this:


    Code:
        _canFocus : function () {
            // In read-only mode we still want to be focusable                                                              
            return (this.isReadOnly() ? true : this.Super("_canFocus", arguments));
        },
    I couldn't override _canFocus because it's minified, but I could override getFocusElement and (I think) get where I want to go.

    Anyway, I've attached the the code since although it's incomplete, you can reproduce the warning yourself here:

    https://www.smartclient.com/smartcli...ariousControls


    Code:
    isc.ClassFactory.defineClass("AttachmentItem",isc.LinkItem);
    isc.AttachmentItem.addProperties({
        showPickerIcon:true,
        pickerIconWidth:18,
        pickerIconHeight:18,
        pickerIconSrc:"[SKIN]/DynamicForm/default_formItem_icon.png",
        canFocus: false
    });
    isc.AttachmentItem.addMethods({
        getLinkHTML: function(){//undocumented API
            this.showValueIconOnly = true;
            var valueIconHTML = this.Super("getLinkHTML", arguments);
            this.showValueIconOnly = false;
            var value = this.getValue();
            if(!value){
                return valueIconHTML;
            }
            var html = valueIconHTML+makeMultiLinkDisplay(value.url,value.fileName,", ");
            return html;
        },
        getFocusElement : function () {
        return true;
        },
    });
Working...
X