bpmn-io / dmn-js

View and edit DMN diagrams in the browser.
https://bpmn.io/toolkit/dmn-js/
Other
297 stars 137 forks source link

Firefox - extra line break while editing header of input field in decision table #375

Open Masiako opened 6 years ago

Masiako commented 6 years ago

Describe the Bug When editing a header of an input field in a decision table through the Browser Mozilla Firefox (newest version) the input field is already populated with a br-tag. As a result the user starts typing in the second line. The extra
tag is also present in other browser, but e.g. ignored in Browser Google Chrome.

image

Steps to Reproduce Open a decision table and try editing an empty header of an input field through using the Browser Mozilla Firefox.

Bug can be reproduced at https://demo.bpmn.io/dmn

Expected Behavior There is no extra br-tag created if the header of an input field is empty.

I believe that the following code fragment is creating the problem in https://github.com/bpmn-io/dmn-js/blob/master/packages/dmn-js-shared/src/components/ContentEditable.js // QUIRK: must add trailing <br/> for line // breaks to properly work value = escapeHtml(value) .replace(/\r?\n/g, '<br/>') + '<br/>';

Probably a simply if-statement checking if value is empty should be enough before adding a trailing br-tag.

Environment

philippfromme commented 6 years ago

I can reproduce this.