Edit keyframe values from graph or dopesheet using Python
When editing the value of the keyframe you have to set both handles as well. Example on how to set the value based on our famous Operator Simple template (should work for the dope sheet too):



import bpy

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"
    bl_options = {'REGISTER', 'UNDO'}

    my_float_y : bpy.props.FloatProperty()

    def cpoints(self, context):
        ctrl_pts = []
        for c in context.selected_visible_fcurves:
            for k in c.keyframe_points:
                if k.select_control_point:
                    ctrl_pts.append(k)
        return ctrl_pts

    @classmethod
    def poll(cls, context):
        areas = ('DOPESHEET_EDITOR', 'GRAPH_EDITOR', 'TIMELINE')
        if context.area.type in areas:
            return True
        else:
            return False 

    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self, width=450)

    def execute(self, context):
        sel = self.cpoints(context)

        for k in sel:
            k.co = (k.co.x, self.my_float_y)
            k.handle_left = (k.handle_left.x, self.my_float_y)
            k.handle_right = (k.handle_left.y, self.my_float_y)
        return {'FINISHED'}

    def draw(self, context):
        lay = self.layout
        lay.row().prop(self, "my_float_y")


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.object.simple_operator()


Alternatively you can use an invoke_props_popup:



See: How do I get invoke_props_popup to work?