[resolved] ccui.Button doesn't activate on touched

I’m failing to get a simple ccui.Button widget to activate. It displays fine, but hover (scale up) or click doesn’t register. Both in the prebuilt test runner when debug/run from the IDE as well as running in browser running of python’s simple server.

Created the project in Cocos Code IDE RC0. Using cocos2d-js-3.0-rc2. I also added “extensions” to the modules in my project.json. Any ideas?

cocos2d-js

var b= new ccui.Button();
b.setTitleText("Play Game");
b.setNormalizedPosition(cc.p(0.5, 0.3));
b.setTouchEnabled(true);
b.setPressedActionEnabled(true);
b.addTouchEventListener(function () { cc.log("touched!"); }, this);
this.addChild(b);

cocos2d-x

auto b = Button::create();
b->setNormalizedPosition(Vec2(0.5, 0.3));
b->setTitleText("PLAY GAME");
b->setPressedActionEnabled(true);
b->setTouchEnabled(true);
b->addTouchEventListener([this](Ref* sender, TouchEventType eventType) {
    CCLOG("touched!");
});
this->addChild(b);

Figured it out. I didn’t understand Button only works correctly with Sprite background. Unless initializing or loading with normal image the contentSize is zero. Instead ui::Text is for text only buttons as any Widget can now be activated by touch.

cocos2d-js

var b = ccui.Text.create("Play Game", "Helvetica", 48);        
b.setNormalizedPosition(cc.p(0.5, 0.3));
b.setTouchEnabled(true);
b.setTouchScaleChangeEnabled(true);
b.addTouchEventListener(function () { cc.log("touched!"); }, this);
this.addChild(b);

cocos2d-x

auto prev = Text::create("Play Game", "Helvetica", 48);
prev->setNormalizedPosition(Vec2(0.5, 0.3));
prev->setTouchScaleChangeEnabled(true);
prev->setTouchEnabled(true);
prev->addTouchEventListener([this](Ref* sender, TouchEventType eventType) {
    CCLOG("touched!");
});

Yea, I think, that should consider as a bug :frowning:
Created an issue for that.